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: So confused as to why this isn't working

Previous Thread :: Next Thread 
sumox567 is not online. sumox567
Joined: 22 Apr 2008
Total Posts: 11191
17 May 2015 11:07 PM
local Switch = script.Parent

function onTouch(part)
if part.Name == ("Input")then
local Door=Switch.Parent.Door
Door.Transparency=1
Door.CanCollide=false
wait(10)
Door.Transparency=0
Door.CanCollide=true
end
end

Switch.Touched:connect(onTouch)

Switch and Door are both part of one model. When input touches the switch, the door should open. Any thoughts?
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
17 May 2015 11:10 PM
I would assume you are getting an error. What's the output say?
Report Abuse
sumox567 is not online. sumox567
Joined: 22 Apr 2008
Total Posts: 11191
17 May 2015 11:10 PM
Nothing at all :/
Report Abuse
mycheeze is not online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
17 May 2015 11:11 PM
local Switch = script.Parent

Switch.Touched:connect(function(P)
if P.Name == 'Input' then print'Working'
local Door = Switch.Parent.Door
Door.Transparency = 1
Door.CanCollide = false
wait(10)
Door.Transparency = 0
Door.CanCollide = true
end
end)
If it prints 'Working' it should be w0rking m8

if it isn't, I blame the Name argument
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
17 May 2015 11:12 PM
This is wrong:
if part.Name == ("Input")then

This is correct:
if part.Name == "Input" then
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
17 May 2015 11:13 PM
Do you have a tool named Input?

If so that's likely your problem, because if you are holding it, then what's actually touching the switch will be called "Handle"

If that is the case, try this:

local Switch = script.Parent

function onTouch(part)
if part.Parent.Name == ("Input") then
local Door=Switch.Parent.Door
Door.Transparency=1
Door.CanCollide=false
wait(10)
Door.Transparency=0
Door.CanCollide=true
end
end

Switch.Touched:connect(onTouch)
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 May 2015 11:16 PM
local Switch = script.Parent
local Door = script.Parent.Parent.Door

function onTouch(part)
if part.Name == "Input" then
Door.Transparency = 1
Door.CanCollide = false
wait(10)
Door.Transparency = 0
Door.CanCollide = true
end
end

Switch.Touched:connect(onTouch)
Report Abuse
sumox567 is not online. sumox567
Joined: 22 Apr 2008
Total Posts: 11191
17 May 2015 11:19 PM
None of that worked :P
Report Abuse
mycheeze is not online. mycheeze
Joined: 27 Jun 2011
Total Posts: 6748
17 May 2015 11:22 PM
If it doesn't work, we blame your script function.

Please come back when you have an actual error so we aren't embarking on a wild goose chase trying to help an ugly shaggy with a problem we can't solve.

Much love your dragoness <3
Report Abuse
sumox567 is not online. sumox567
Joined: 22 Apr 2008
Total Posts: 11191
17 May 2015 11:24 PM
Hm, fixed on its own, thanks guys, but not sure what was wrong.

thank you for the help though!
Report Abuse
sumox567 is not online. sumox567
Joined: 22 Apr 2008
Total Posts: 11191
17 May 2015 11:25 PM
@cheeze

thats a little bit rude, don't you think?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 May 2015 11:25 PM
fixed it on its own [2]
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
17 May 2015 11:29 PM
No that wasn't rude, it was the truth.
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