Hello all, me again. Have another debounce issue, and don't understand as to why this isn't working properly! Looking to make a GUI pop up if player doesn't have the proper leaderstat value, or more than the proper leaderstat value!
Here is my SCRIPT and the GUI is the child of the SCRIPT
Any and ALL HELP is appreciated!
local debounce = false
script.Parent.Touched:Connect(function(hit)
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local lvl = player.leaderstats.Door1
if player and lvl.Value > 1 and not player.PlayerGui:FindFirstChild('buydoor') then
script.Parent.CanCollide = false
else
local cloneui = script.buydoor:Clone()
cloneui.Parent = player.PlayerGui
cloneui.Frame:TweenPosition(UDim2.new(0.25,0,0.2,0))
debounce = false
end
end)

3 comments
I believe this code will work, but I'm experiencing a problem now as well with the local lvl as it's calling for "player" which is nil to the server. I've added :WaitForChild("leaderstats"):WaitForChild("Door1") which didn't work, and still says it is nil, how to fix this?
change the if statement on line 9 to: if player and player.leaderstats.Door1.Value > 1 and not player.PlayerGui:FindFirstChild('buydoor') then
Of course if this is a server script like you say, the "buydoor" inside of the PlayerGui must have been put there by the server too. If it wasn't and filtering is enabled you'll probably run into another error.