Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't theme park door opening when touched?

Asked by 3 years ago

So I am making this hangout game, Ok, and there is a theme park which you need to pay to open, here is the current script and if you know what's wrong send me the new code. Thanks!

db = false 

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if db == false then
            db = true
            if player.leaderstats.Cash.value >= 50 then
                player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 50
                script.Parent.Transparency = 0.6
                script.Parent.CanCollide = false
                wait(1)
                script.Parent.Transparency = 0.5
                script.Parent.CanCollide = true
            db = false
        end
    end
end)

Normal script not local.

0
That wait() is so short. Try removing it entirely and the part after it, to see if it's working or not. Also any errors? Xx_FROSTBITExX 116 — 3y
0
That's not the issue, it's because in this line: if player.leaderstats.Cash.value >= 50 then value is undercase when it should be Value WooleyWool 15 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

Your line:

            if player.leaderstats.Cash.value >= 50 then

should be:

            if player.leaderstats.Cash.Value >= 50 then

0
didnt work FlyingGorillaFanNoob 20 — 3y
0
Any errors? WooleyWool 15 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

On your line you have:

``player.leaderstats.Cash.Value = " so is that it as the code hasn't been finished? I am new to scripting btw.

Answer this question