Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
|
| 08 Mar 2015 12:08 PM |
I'm trying to work a keycard.
It works like, if the model name is keycard, and it touches a part, than the door is supposed to open.
local door = game.Workspace.DoorNameHere--"script.Parent"
function onTouched(part) if part.Parent.Name == "KeyCard" then print("Touched") door.Transparency = 1 door.CanCollide = false wait(2) door.Transparency = 0 door.CanCollide = true
end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
| |
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
| |
|
|
| 08 Mar 2015 12:17 PM |
If KeyCard is a model I don't think the Touched event works on models.
Yup I was right:
AncestryChanged ( Instance child, Instance parent ) Fires when the Parent property of the object or one of its ancestors is changed. Changed ( Property property ) Fires when a property of the object changes. ChildAdded ( Instance child ) Fires when a child is added to the object. ChildRemoved ( Instance child ) Fires when a child is removed from the object. DescendantAdded ( Instance descendant ) Fired when a descendant is added to the object. DescendantRemoving ( Instance descendant ) Fires before a descendant of the object is removed.
http://wiki.roblox.com/index.php?title=Model
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
|
| 08 Mar 2015 12:20 PM |
| So you could help me make the script :} |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
| |
|
|
| 08 Mar 2015 12:23 PM |
Is the KeyCard a model?
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
| |
|
|
| 08 Mar 2015 12:24 PM |
What is the main Part in the model?
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
|
| 08 Mar 2015 12:25 PM |
What do you mean by main part?
Like the handle? |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 12:28 PM |
Eh wahtever.
local door = game.Workspace.DoorNameHere
function onTouched(hit) if hit.Parent.Name == "KeyCard" then keycard = hit.Parent:findFirstChild("Handle") door.Transparency = 1 door.CanCollide = false wait(2) door.Transparency = 0 door.CanCollide = true end end
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
|
| 08 Mar 2015 12:31 PM |
| And does this go in the keycard? |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 12:32 PM |
local door = game.Workspace.DoorNameHere
function onTouched(hit) if hit.Parent.Name == "KeyCard" then keycard = hit.Parent:findFirstChild("Handle") door.Transparency = 1 door.CanCollide = false wait(2) door.Transparency = 0 door.CanCollide = true end end
script.Parent.Touched:connect(onTouched)
needed to make a change
Put it in the keycard slot of the door.
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
|
| 08 Mar 2015 12:49 PM |
Strange. It's still not working.
I have a tool named keycard And the script is in the door |
|
|
| Report Abuse |
|
|
Bitwyl
|
  |
| Joined: 15 Nov 2014 |
| Total Posts: 7276 |
|
|
| 08 Mar 2015 12:50 PM |
| I take that back, it's not a tool |
|
|
| Report Abuse |
|
|