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

script isnt working in the startergui [works in studio, won't work in game]?

Asked by 7 years ago

script is for changing a team the TeamNum.value is obviously the team selection since the team is created in another script. Works in studio but won't work in game, shows no errors

function Click(mouse) 
if script.Parent.Parent.Parent.Parent:IsInGroup(1148295) then 
game.Players.LocalPlayer.TeamNum.Value = 1
script.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 

game.StarterGui.TeamChange:remove()
end
end

script.Parent.MouseButton1Down:connect(Click)



0
Is it a local script? bigbenbennett 18 — 7y

1 answer

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

You're changing stuff in startergui. This is the service that replicates everything inside of it into a players PlayerGui when their character adds. You should change everything in game.Players.LocalPlayer.PlayerGui.* instead of game.StarterGui.* You can read more about it here

Ad

Answer this question