Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Index the localplayer in Workspace?

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)

4 comments

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

0

Also why do you have your glove in workspace, starterpack would be better.

0

the glove is inside of the player in workspace

0

Player is not a valid member of Workspace @TheOnlySmarts

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.