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

Why does my characters arm only move for me and not for other players?

Asked by 4 years ago

I have a local script which rotates a Motor6D with CFrame. But the arm rotates only for the player and not for the server (other players). I can see the rotation but other not. What can I do so other players can see what the player does (like arm movement)?

3 answers

Log in to vote
2
Answered by 4 years ago

You have to understand the importance of acknowledging the difference between a Local script and a server script. Only use a Local script whenever you want something done locally and a server script whenever you want to execute something for the server.

Learn also the importance of remotes. Because remotes will allow you to communicate between the server and the client (local), mastering or even gaining a heads up to this stuff will allow you to execute your codes more efficiently.

0
That's a given why your code doesn't appear to other players, because they are distributed as clients of the server, however you're only executing it from a local script which is your local client only. Using remotes and learning how to use Server script will allow you to distribute your code to the server and to all of the clients. roussimoff 17 — 4y
0
^ can confirm this is important zadobyte 692 — 4y
0
same greatneil80 2647 — 4y
Ad
Log in to vote
1
Answered by
zadobyte 692 Moderation Voter
4 years ago
Edited 4 years ago

You should add a remote event instance and place it inside ReplicatedStorage. Then follow the following steps:

--Local Script
local remote = (remote-event-location)
tool.Equipped:Connect(function()
    remote:FireServer()
end)

then:

--Server Script
local remote = (remote-event-location)
remote.OnServerEvent:Connect(function()
    --move the arm
end)

For more info, read this article on remote events (and functions which may not be necessary for you at the minute). Please accept the answer if I helped you solve your problem.

EDIT: code changed to suit needs

0
how does the --move the arm script look like? Hyperpublic 4 — 4y
0
that depends on how you wrote it. you did have the script moving your arm prior to this correct? zadobyte 692 — 4y
0
I made a script which detects if the player has a tool in hand and then that moves the arm with this script: ~~~ Shoulder.C0 = Shoulder.C0 * CFrame.Angles(math.rad(-90),0,0) ~~~ Hyperpublic 4 — 4y
0
changed the code zadobyte 692 — 4y
Log in to vote
0
Answered by
ghxstlvty 133
4 years ago

ANSWER: You are using a Local Script instead of a Server Script.

Local Scripts are client sided and Server Scripts are server sided.

Answer this question