Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My remote function script isn't firing/working properly? Am I doing something wrong?

Asked by 4 years ago
Edited 4 years ago

I made a script that moves your arm up and down. I tried to make it FE with a remote function but it doesn't work for some reason. Can someone help? Am I doing something wrong? Thanks.

Here's what it looks like: https://gyazo.com/2529c4c9f89694a041dc731ca03e7399

^^^ The arm script doesn't move the arm for other players to see, only for the client.

Server script:

script.Parent.Equipped:Connect(function()
    script.Parent.ArmEvent:FireAllClients()
end)

Local script:

script.Parent.ArmEvent.OnClientEvent:Connect(function()
game:GetService("RunService").RenderStepped:connect(function()
local function onEquipped(mouse)
    active = true

    while active == true do
        shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y),1.55,0)
        wait()
    end
end
wait()
script.Parent.Equipped:connect(onEquipped)

script.Parent.Unequipped:connect(function()
    active = false
    shoulder.C0 = original
end)
end)
end)

1 answer

Log in to vote
1
Answered by 4 years ago

You can't run

script.Parent.Equipped:Connect

from a server script as far as I know, you'll want to do that in a localscript, fire it to the server, which fill fireallclients with the info. If this helped you out, please mark it as the answer

0
The script is made for a local script not server script. A server script can't get game.Players.LocalPlayer, so I don't know what to do. iinaoriku 52 — 4y
0
NVM found out how to get local player from a server script Lol iinaoriku 52 — 4y
Ad

Answer this question