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

Can someone help me with this group only team change GUI?

So I own a Roblox Army group, and I'm almost done with the base, except I can't seem to get this GUI to work. I'll post the code I have inside the TextButton Below.

function Click(mouse)
if script.Parent.Parent.Parent.Parent.Parent:IsInGroup(4123247) then
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Crimson")
end
end

script.Parent.MouseButton1Click:connect(Click)

Any help would be appreciated.

2 comments

0

What exactly do you need help with here?

1

Instead of using tons of script.Parents use game.Players.LocalPlayer thanks.

1 answer

There is no need to use tons of parents. This is local script, meaning you can reference the player by using game.Players.LocalPlayer

Result:

local player = game.Players.LocalPlayer
function Click(mouse)
if player:IsInGroup(4123247) then
player.TeamColor = BrickColor.new("Crimson")
end
end

script.Parent.MouseButton1Click:connect(Click)

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