This used to work previously. Then I tried adding a debounce on, and it didnt work. Instead of researching what was going on, I decided to use values to debounce, a terrible idea. I messed up the script, tried to revert it, and I got an error. Can somebody please help me? This error is probably obvious and i just didn't catch it.
EDIT: I think I know what I did wrong, I just want confirmation. But if I dont get it in a while I'll just try it out and see if it works
EDIT2: I FIGURED IT OUT MYSELF
local WinPart = script.Parent
WinPart.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if player then
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local player = game.Players.LocalPlayer
local Location = game.Workspace.TeleportLocation
player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(Location.Position)
wait(1)
end
end
end)

5 comments
Also, I remember the code being longer, maybe that was just be adding the debounce in
By context, I assume this code is written in a regular Script, therefore, line 14 is likely where you're experiencing your issue.
The LocalPlayer pointer refers to a Client—thus why LocalScripts are the only Instance able to reference it—since this program is operating on the Server, the return value is null.
Regardless, you've already allocated the proper Player Object on line 4, simply remove 14 and you're good to go!
Well, its fixed anyway. I thought I was calling the thing at the beggining of the script. All I had to do was change the capitalization and it fixed itself.