generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What's the problem here?

Previous Thread :: Next Thread 
Bitwyl is not online. 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 is not online. Bitwyl
Joined: 15 Nov 2014
Total Posts: 7276
08 Mar 2015 12:11 PM
b1
Report Abuse
Bitwyl is not online. Bitwyl
Joined: 15 Nov 2014
Total Posts: 7276
08 Mar 2015 12:15 PM
b2

Please help
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
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 is not online. 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 is not online. Bitwyl
Joined: 15 Nov 2014
Total Posts: 7276
08 Mar 2015 12:22 PM
b3
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
08 Mar 2015 12:23 PM
Is the KeyCard a model?

"I like to program." - Bosswalrus
Report Abuse
Bitwyl is not online. Bitwyl
Joined: 15 Nov 2014
Total Posts: 7276
08 Mar 2015 12:23 PM
Yeah
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
08 Mar 2015 12:24 PM
What is the main Part in the model?

"I like to program." - Bosswalrus
Report Abuse
Bitwyl is not online. 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
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
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 is not online. Bitwyl
Joined: 15 Nov 2014
Total Posts: 7276
08 Mar 2015 12:31 PM
And does this go in the keycard?
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image