so im trying to make a simple door part where if the player touches and doesn't have enough coins, they can't enter whilst if they have enough coins, they can go through
local Door = script.Parent
local player = game.Players.LocalPlayer
---
Door.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
if player:WaitForChild("leaderstats"):FindFirstChild("Coins").Value > 3 then
print("u have enough coins")
Door.Transparency = 0.8
Door.CanCollide = false
elseif player:WaitForChild("leaderstats"):FindFirstChild("Coins").Value < 3 then
print("u dont have enough coins")
Door.Transparency = 0
Door.CanCollide = true
end
end
end)
but it keeps showing up as an error and i cant seem to fix it. ive tried setting
player:WaitForChild("leaderstats"):FindFirstChild("Coins") = local Coins
but it still doesnt work. anyone can help?

1 comment
What's the error