I have a game where you advance to the next level by earning XP and when you have the designated amount of XP a part will be destroyed so you can go through it (Client sided).
I believe that it should work but I get no printed text etc. No error either.
LOCAL SCRIPT:
local plr = game:GetService("Players").LocalPlayer
local function CheckIfEnough()
if plr:WaitForChild("leaderstats").XP.Value >= 500 then
print("Test")
script.Parent.Parent.NextLevelBrick:Destroy()
end
end
plr:WaitForChild("leaderstats").XP.Value.Changed:Connect(CheckIfEnough() -- If the xp value of a player changes it will run the function.

1 comment
Thank you!