I am trying to rotate a part using localscripts so that only one client will see the part rotating, not the server or the other clients. How would I go about doing that? I read this post, but it didn’t work https://devforum.roblox.com/t/rotating-a-part-using-a-local-script/720329
Thanks
Well, I think you are misunderstanding what they were trying to achieve if you rotate a part in a localscript it will do what you want.
They wanted a client to fire a remote that would rotate a part(On the server) but from a client which cant do with just a localscript
localscripts interacts with the client and only the client unless you fire a remote
Yeah, I want the part to rotate on the client so, it will be server to client. But I don’t know how to do that
from a localscript
that wont happen unless you use a regularscript
if you want to know how to rotate the part you can use that topic u have linked as a resource
Yeah I know hot to rotate the part but I don’t know how to use the remoteEvents to communicate with the localscript so that it rotates the part only for that client.
Do you want to :FireClient()
I thought you just wanted a localscript to rotate a part
but you want the server to tell the client to rotate the part from the server. Sorry I thought you were over-complicating things
Heres a link to :FireClient() documentation
Also can you explain why you need remotes just so I can understand what your trying to do
Yeah I think I need :FireClient()
I am trying to make a trap in my game, Its this kind of door that rotates when a player touches it. I want the door to rotate only for the player that touched it, the other players shouldn’t see the door rotating.
In your instance, FireClient()
requires a player argument before you can send it from the server to the client side
The thing is though, are you wanting to make this trigger for all players that touch it or just once after someone triggers it?
local Part = script.Parent
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
Part.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
Event:FireClient(Player)
end
end)
--Client Side in a LocalScript
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local PartToRotate = --Your part here
Event.OnClientEvent:Connect(function()
PartToRotate.Orientation = Vector3.new(-90, 0, 0)
end)
Thanks, it works