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

How to make parts unanchor for only the client that executed it?

Asked by 3 years ago

I am making a game and you can unlock a character, but to unlock it you need to break some barriers, but I don't know how to make them break for only that one client but not the others that didn't do it. The code I were thinking of doing before I knew I had to do ClientSided was

local PartsToBreak = game.workspace.SecretCharacterLockedUpPlanks:GetChildren()
PartsToBreak.ClickDetector.Mouseclick:Connect(function()
    PartsToBreak.anchored = false
end)

I think it is something like that but I need it to be ClientSided instead of ServerSided.

1 answer

Log in to vote
0
Answered by 3 years ago

You gotta loop thought all parts like this:

local parts = game.Workspace.Folder:GetChildren()

for i,v in pairs(parts) do v.Anchored = false end

Make sure to put the LocalScript where it can be executed by the client (ex: startergui, starterplayer, etc)

Ad

Answer this question