位置查找器不工作,而是显示一些不寻常的东西。有什么帮助吗?罗布乐思工作室

The location finder is not working and instead is showing something unusual. Any help? Roblox Studio

我正在尝试制造一把符合我所有标准的枪,并且直到现在都进展顺利。我编写了一个代码,每次玩家点击鼠标时,它都会记录枪管位置,这是一个额外的秘密部分,它只是一个产生子弹的地方。不幸的是,我必须使用本地脚本,因为服务器脚本会在您处理它的隐藏枪中产生子弹。所以,我想使用远程事件将信息发送到服务器脚本以在那里生成子弹。但出于某种原因,它说 'VoltyDeElectroDragon 328.80020141602 3.400004863739' 而不是 '328.80020141602 3.400004863739 -144.67500305176' 我不知道出了什么问题。我的枪的不同版本也出现了同样的问题。这是本地脚本代码:

local mouse = player:GetMouse()
local barrel = script.Parent:WaitForChild("Barrel", 0.00001)
local barrelx = barrel.Position.X
local barrely = barrel.Position.Y
local barrelz = barrel.Position.Z

script.Parent.Equipped:Connect(function()
    script.Parent.Activated:Connect(function()
        local HitX = mouse.Hit.X
        local HitY = mouse.Hit.Y
        local HitZ = mouse.Hit.Z
        print(barrelx, barrely, barrelz)
        script.Parent.Fire:FireServer(barrelx, barrely, barrelz)
    end)
end)

这是服务器脚本代码:

local bullet = game.ReplicatedStorage.Bullet
local gunposX = script.Parent.Barrel.Position.X
local gunposY = script.Parent.Barrel.Position.Y
local gunposZ = script.Parent.Barrel.Position.Z

local function Fire(barrelx, barrely, barrelz)
    print(barrelx, barrely, barrelz)
    part.Position = Vector3.new(HitX, HitY, HitZ)
    local bulletcopy = bullet:Clone()
    bulletcopy.Parent = game.Workspace
    bulletcopy.Position = Vector3.new(gunposX, gunposY, gunposZ)
    local Bulletshoot = Instance.new("BodyForce", bulletcopy)
    Bulletshoot.Force = Vector3.new(0, 0, 100)
end

script.Parent.Fire.OnServerEvent:Connect(Fire)

调用 FireServer()

RemoteEvent's OnServerEvent is the player 上的第一个参数

您需要更新函数签名来解决这个问题:

local function Fire(player, barrelx, barrely, barrelz)