So I have a brick that if touched then it changes the localplayers XP to 5000, levelling them up.
script.Parent.Parent.Touched:connect(function(brick) game.Players.LocalPlayer.XP.Value = 5000 end)
It works fine as a Script, and when I run it in studio, it works, levelling me up to level 2, however when I publish and play in game it does nothing, expected as it is a script.
So I copy and paste it onto a localscript and put it in the brick, but now it does nothing, in studio and in-game, help?
Edit: Yes I have checked for errors, in game, and in studio
You defined the brick that touched the part but did not use it. This works:
script.Parent.Touched:connect(function(hit) local user = game.Players:GetPlayerFromCharacter(hit.Parent) user.Xp.Value = 5000 end)