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 part invisible on touch even though I have more than zero points?

Ok, so I'm making this obby game where you win obbies for points, the player starts with zero points so I made a door so if you have zero or more points you can enter, however, I have checked all the coding and nothing seems to be wrong but it isn't working. Does anyone have a solution and can send me the updated code? Here is the code:

db = false 
local min_lev = 0

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.Points >= min_lev then
				script.Parent.CanCollide = false
				script.Parent.Transparency = 1
				wait(.5)
				script.Parent.CanCollide = true
				script.Parent.Transparency = 0.6
			end
			
			db = false
		end
	end
end)

Thanks!

1 comment

0

is this in a regular Script or a LocalScript

1 answer

✓ Accepted answer

ohhh ok so on line 9 it says:

if player.leaderstats.Points >= min_lev then

and I think you meant to put:

if player.leaderstats.Points.Value >= min_lev then

because right now you are comparing a number value instead of just the value.

i hope this helps!

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