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

Int. Value. Making a Door! Please Help?

Asked by 9 years ago

Im Making a door that locks behind its self for a period of time.. Im trying to do this using int. Value!

script.Parent.ClickDetector.MouseClick:connect(function()
    if game.Workspace.Value >= 10 then
        game.Workspace.Value = 11
    else
    script.Parent.Parent.Door1.Transparency = 1
    script.Parent.Parent.Part1.Transparency = 1
    wait(1)
    script.Parent.Parent.Door2.Transparency = 1
    script.Parent.Parent.Part2.Transparency = 1
    wait(2)
    script.Parent.Parent.Door2.Transparency = 0
    script.Parent.Parent.Part2.Transparency = 0
    wait(1)
    script.Parent.Parent.Door1.Transparency = 0
    script.Parent.Parent.Part1.Transparency = 0
    game.Workspace.Value = 11   


    end
end)

Out Put:

--Workspace.Model.Button.Script:2: attempt to compare number with userdata

2 answers

Log in to vote
0
Answered by
KarlXYZ 120
9 years ago

Assuming that "Value" is referencing to an IntValue object in the Workspace that's called "Value", you should be doing this:

script.Parent.ClickDetector.MouseClick:connect(function()
    if game.Workspace.Value.Value >= 10 then
        game.Workspace.Value.Value = 11
    else
    script.Parent.Parent.Door1.Transparency = 1
    script.Parent.Parent.Part1.Transparency = 1
    wait(1)
    script.Parent.Parent.Door2.Transparency = 1
    script.Parent.Parent.Part2.Transparency = 1
    wait(2)
    script.Parent.Parent.Door2.Transparency = 0
    script.Parent.Parent.Part2.Transparency = 0
    wait(1)
    script.Parent.Parent.Door1.Transparency = 0
    script.Parent.Parent.Part1.Transparency = 0
    game.Workspace.Value.Value = 11   
    end
end)

You need to be referencing the Value property of an IntValue object. That property is what holds the integer.

Ad
Log in to vote
0
Answered by 9 years ago

If value is an IntValue in Workspace, it would be this (line 2):

if game.Workspace.Value.Value >= 10 then 

There is no "Value" property of Workspace.

Answer this question