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

Local script doesn't show for other players?

Asked by 4 years ago

Hi, I have a local script that rotates a player's head depending on where their camera is facing, however other players can't see others' heads turning and can only see their own rotating. How would I make it so everyone can see everyone's heads rotating, would I need to do something with ReplicatedStorage?

Any help would be great. :)

0
It Would need to be inside of a server script since you are trying to move something inside the workspace UnforgivenJr3087 26 — 4y
0
The script doesn't work in a server script LouieN07 16 — 4y

1 answer

Log in to vote
0
Answered by
2ndwann 131
4 years ago
Edited 4 years ago

To do that, try to make a RemoteEvent and trigger it whenever the camera rotation is changed. Send the new camera rotation as a parameter to the RemoteEvent. The RemoteEvent will be connected a server script, and the server script will change the rotation of the player from the parameter you passed. You do not have to specify which player to rotate the head, as there is a default 'player' parameter that is passed to your function that is listening to the RemoteEvent.

For an example, I will show you the server script:

-- Server Script
local event = game:GetService("ReplicatedStorage"):WaitForChild("HeadRotationEvent") -- put the name of the RemoteEvent there

event.OnServerEvent:Connect(function(player, newRotation)
    -- your code here
end

I hope this explanation is of help.

Ad

Answer this question