**I have tried to find what the error is but im new to studio and dont understand can someone please help me! **
script.Parent.Touched:Connect(function(hit)
if hit then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.leaderstats.Coin.Value >= script.Parent.Requirement.Value then
player.leaderstats.Coin.Value -= script.Parent.Requirement.Value
for i,v in pairs(workspace.Maps.DesertMap:GetChildren()) do
v.Transparency = 1
v.CanCollide = false
end
end
end
end)

2 comments
I am trying to make a door that when you walk into it your money will be deducted from ur coins
What does attempt to index nil with mean