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

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

Asked by 5 years ago

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.

0
What exactly do you need help with here? a4aw -5 — 5y
1
Instead of using tons of script.Parents use game.Players.LocalPlayer thanks. User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by
piRadians 297 Moderation Voter
5 years ago
Edited 5 years ago

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)

Ad

Answer this question