You have to wait for XP not FindFirstChild... another issue is that you cannot change values localside (meaning everyone can see it as serversided). Changing values with a localscript on does localside so others will not see your level / scripts wont be able to see the hacked level! Instead use below.
In LocalScript
local plr = game.Players.LocalPlayer
local Stats = game.Players.LocalPlayer:WaitForChild("Stats")
local XP = Stats:WaitForChild("XP")
if XP.Value > 70 then
game.ReplicatedStorage:WaitForChild("LevelUpEvent"):FireServer(12345)
end
In ServerScript
local event = Instance.new("RemoteEvent")
event.Name = "LevelUpEvent"
event.Parent = game.ReplicatedStorage
local SecurityIDD = "12345"
event.OnServerEvent:Connect(function(player, SecurityID)
if SecurityID == SecurityIDD then
player:WaitForChild("leaderstats"):WaitForChild("Level").Value = player:WaitForChild("leaderstats"):WaitForChild("Level").Value + 1
player:WaitForChild("Stats"):WaitForChild("XP").Value = 0
end
end)
1 comment
is it named XP?