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

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

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)



1 comment

0

Is it a local script?

1 answer

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

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