Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't theme park door opening when touched?

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.

2 comments

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?

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

2 answers

✓ Accepted answer

Your line:

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

should be:

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

2 comments

0

didnt work

0

Any errors?

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.