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

Index the localplayer in Workspace?

Asked by 6 years ago

So basically, when you press a gui button your characters glove color will change. I have this part down but how can I index the localplayer inside of the Workspace? So it knows who you are? Sorry if this is confusing but this is what I have so far.

script.Parent.TextButton.MouseButton1Click:Connect(function()
    game.Workspace.(this is where i want to index the local player inside of the workspace).GloveV8.Handle.BrickColor = BrickColor.Random()
end)
0
do local Player = game.Players.LocalPlayer before the function and in your function do game.Workspace.Player.GloveV8.Handle.BrickColor = BrickColor.Random() || hopefully this helps TheOnlySmarts 233 — 6y
0
Also why do you have your glove in workspace, starterpack would be better. TheOnlySmarts 233 — 6y
0
the glove is inside of the player in workspace Neon_isHere 100 — 6y
0
Player is not a valid member of Workspace @TheOnlySmarts Neon_isHere 100 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

LocalPlayer.Character tells it to look inside the player's character model located in workspace.

script.Parent.TextButton.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.Character.GloveV8.Handle.BrickColor = BrickColor.Random()
end)

I'm not the best at scripting, so if I'm wrong feel free to correct me.

Ad

Answer this question