So I was making a game, I found out an error for my game and I got stuck on it. If you can help out, that would be appreciated! I will be hearting every comment in this topic!
Script (Inside a part):
local Players = game:GetService("Players")
local part = script.Parent
local cooldown = false
script.Parent.Touched:connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if cooldown == false then
if player and player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("MapsCompleted") and player:FindFirstChild("Stats") and player.Stats:FindFirstChild("Maze1Win") then
if player.Stats.Maze3Win.Value == false then
hit.Parent:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-121, 3, -619)))
print("u win lol")
cooldown = true
player.leaderstats.MapsCompleted = player.leaderstats.MapsCompleted + 1
wait(.1)
player.Stats.Maze3Win.Value = true
elseif player.Stats.Maze3Win.Value == true then
hit.Parent:SetPrimaryPartCFrame(CFrame.new(Vector3.new(-121, 3, -619)))
print("u did this again?!!")
end
end
elseif cooldown == true then
wait(.1)
cooldown = false
end
end)
once again, if you can help it would be appreciated!