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

Door clearance leaderstat not returning a value?

Asked by 10 years ago

I have an error at line 10, It reads:

Clearance is not a valid member of Part

Here is my code:

moving = script.Parent.Parent.Moving
open = script.Parent.Parent.Open
local trigger = script.Parent
local gate = script.Parent.Parent.Door

moving.Value = false
open.Value = false

function onTouched(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent).leaderstats.Clearance.Value >= script.Parent.Clearance.Value then --AFFECTED LINE
if open.Value == false and moving.Value == false then
gate.Smoke.Enabled = true
moving.Value = true
script.Parent.Whoosh:Play()

for i = 1, (gate.Size.Y * 2 + 2) do
wait()
gate.CFrame = gate.CFrame*CFrame.new(0, 0, -0.6)
end
gate.Smoke.Enabled = false
moving.Value = false
open.Value = true
wait(5)
gate.Smoke.Enabled = true
moving.Value = true
script.Parent.Whoosh:Play()
for i = 1, (gate.Size.Y * 2 + 2) do -- * 12 + 6
wait()
gate.CFrame = gate.CFrame*CFrame.new(0, 0, 0.6)
end
gate.Smoke.Enabled = false
moving.Value = false
open.Value = false

end
end
    end
script.Parent.Touched:connect(onTouched)

WOW, IM AN IDIOT! Sorry.

Answer this question