I see the issue. First thing I notice is that this is a local script. Meaning that you cannot call the 'Touched' event from it. You can get a player from a touched brick easily, you first check that touch part is a real player part.
local function PlayerTouched(prt)
local humanoid = prt.Parent:FindFirstChild("Humanoid")
if humanoid then
end
The function ":FindFirstChild()" will take it's argument, and if it finds the object inside of instance before it, then it will return true. In this case, a player touches (let's say, their arm) and then, it goes: prt.Parent (which would be the player model), then it goes :FindFirstChild("Humanoid"), so it looks for "Humanoid" inside the player model, it's a player model so it finds it and returns true! This means our "if" statement becomes true and runs the following code block in it.
Then you get their player.
local plr = game.Players:GetPlayerFromCharacter(prt.Parent)
"GetPlayerFromCharacter" basically takes the character model as an argument, to find the player instance. In this case, the player model is prt.Parent so we give it prt.Parent and it returns the player instance.
Then we edit the values as such!
local stage = plr.PlayerGui.leaderstats.Stage
local stageVal = stage.Value
Run this all from a normal script inside the brick.
EXTRA note: Local scripts are the only scripts able to call "Local Player", normal scripts can not as they are run from a server and not a client.
3 comments
Few things wrong with this script. You aren't suppose to do game.StarterGui, it Player.PlayerGui, you also can't call LocalPlayer from a normal script.
You also forgot to say Stage.Value
oh