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

Help with a key door tool?

Asked by
Seenit 80
10 years ago

It works in playtest but not online. I'm not sure what's wrong and output tells me nothing.

bin = script.Parent

function onButton1Down(mouse)

    local hit = mouse.Target
    if (hit == nil) then return end
    if (hit.Name == "SilverDoor2") then
    hit.Transparency = 0.8
    hit.CanCollide = false
    wait(2)
    hit.CanCollide = true
    hit.Transparency = 0

    end
end

function onSelected(mouse)
    print("Action Tool Selected")

    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

bin.Selected:connect(onSelected)

2 answers

Log in to vote
3
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

Add wait() to the beginning of the script. Scripts that run locally or are based on client-sided objects should be careful to wait that everything has loaded, and for hopperbins this usually fixes it.

0
Sadly, this doesn't work. The function onSelected does work. But onButton1Down does not work. Seenit 80 — 10y
Ad
Log in to vote
-2
Answered by 10 years ago

go here it will help you:

http://wiki.roblox.com/index.php?title=Special%3ASearch&search=key+door&go=Go

Answer this question