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

Why isn't part invisible on touch even though I have more than zero points?

Asked by 4 years ago

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!

0
is this in a regular Script or a LocalScript Elyzzia 1294 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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!

Ad

Answer this question