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

Help With This Key Door Script?

Asked by
Seenit 80
11 years ago

the parent is the tool. This is for a key door, this script allows you to go through the door. But it just won't.

Also it works in Playtest but not Online

01bin = script.Parent
02 
03function onButton1Down(mouse)
04 
05    local hit = mouse.Target
06    if (hit == nil) then return end
07    if (hit.Name == "SilverDoor2") then
08    hit.Transparency = 0.8
09    hit.CanCollide = false
10    wait(2)
11    hit.CanCollide = true
12    hit.Transparency = 0
13 
14    end
15end
View all 23 lines...

2 answers

Log in to vote
0
Answered by 11 years ago
01bin = script.Parent
02 
03function onButton1Down(mouse)
04 
05    local hit = mouse.Target
06    if (hit == nil) then return end
07    if (hit.Player.Name == "SilverDoor2") then
08    hit.Transparency = 0.8
09    hit.CanCollide = false
10    wait(2)
11    hit.CanCollide = true
12    hit.Transparency = 0
13 
14    end
15end
View all 23 lines...

You use 'hit.Player.Name'

Ad
Log in to vote
-1
Answered by 11 years ago

i think the problem is when you put end on 14 and 15,so try removing end

0
No, there is two "If"'s there, That's right. also it only works in playtest mode. Seenit 80 — 11y

Answer this question