I am having trouble with this script, and it keeps giving me this error Workspace.TreadmillXP.Script:2: attempt to index local 'Player' (a nil value) Here is the script
local Player = game.Players.LocalPlayer local LeaderStats = Player:WaitForChild("leaderstats") local Level = LeaderStats:WaitForChild("Level")
script.Parent.Touched:connect(function(touch) if touch.Parent:findFirstChild("Humanoid") then touching = true while touching do print("Touching....") wait() end end end)
script.Parent.TouchEnded:connect(function(untouch) if untouch.Parent:findFirstChild("Humanoid") then touching = false end end)

2 comments
Is this a local script?
Please format the script in your question.