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 » Scripting Helpers
Home Search
 

Re: OnTouch problem?

Previous Thread :: Next Thread 
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 11:35 AM
I'm starting to get more advanced in my beginner level coding. I don't see the error(s) in this:
function OnTouched(hit)
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = true
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait()
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
wait(6)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait()
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = false

Any help?

--Apparantly the forum dosent display my tabbing.--
Report Abuse
ckfeister is not online. ckfeister
Joined: 27 Feb 2010
Total Posts: 1506
18 Sep 2012 11:57 AM
function OnTouched(hit)
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = true
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait()
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
wait(6)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait()
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = false
end


script.Parent.Touched:connect(OnTouched)



[Wanna join a 70+ member group? Join my primaly!]
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 12:01 PM
Oh. Yeah. I forgot about that connection again. -_-
Report Abuse
itunes89 is not online. itunes89
Joined: 19 Jan 2011
Total Posts: 1957
18 Sep 2012 12:01 PM
And your end.

--Itunes89 Expert Scripter, Wiki Writer and Friend
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 12:08 PM
Still dosent activate the script.
Report Abuse
itunes89 is not online. itunes89
Joined: 19 Jan 2011
Total Posts: 1957
18 Sep 2012 12:44 PM
    function OnTouched(hit)
    game.Workspace.EnergyBridge.EnergyPlatform.CanColide = true
    game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
    wait()
    game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
    wait(6)
    game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
    wait()
    game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
    game.Workspace.EnergyBridge.EnergyPlatform.CanColide = false
    end
    script.Parent.Touched:connect(OnTouched)
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 01:00 PM
Still failing. -.-
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 01:24 PM
When run correctly, this is supposed to make the brick change transparency and CanColide, then Transparency and CanColide again. It dosent work. Anyone see the error?
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
18 Sep 2012 01:26 PM
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = true
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(1)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
wait(6)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(1)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = false
end

script.Parent.Touched:connect(OnTouched)
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 01:32 PM
Nope.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
18 Sep 2012 01:52 PM
    function OnTouched(hit)
     game.Workspace.EnergyBridge.EnergyPlatform.CanCollide = true
     game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
     wait()
     game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
     wait(6)
     game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
     wait()
     game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
     game.Workspace.EnergyBridge.EnergyPlatform.CanCollide = false
    end

script.Parent.Touched:connect(OnTouched)

Next time, an output would be helpful.

¤ ¤ † K M X D † ¤ ¤
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 02:01 PM
First of all, I use output. Second, that dosent work.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
18 Sep 2012 02:04 PM
Then why didn't you post it? There had to be one because CanCollide was spelled incorrectly. Is your hierarchy right?

¤ ¤ † K M X D † ¤ ¤
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 02:23 PM
15:17:55 - CWorkspace::DoExecScript
15:17:55 - DataModel Loading http://www.roblox.com/asset/?id=27000387
15:19:33 - CApp::RobloxAuthenticate

Thats my output.
Report Abuse
corto713 is not online. corto713
Joined: 12 Dec 2009
Total Posts: 962
18 Sep 2012 02:34 PM
Maybe try this?



function OnTouched()
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = true
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(1)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
wait(6)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(1)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = false
end

script.Parent.Touched:connect(OnTouched)
Report Abuse
corto713 is not online. corto713
Joined: 12 Dec 2009
Total Posts: 962
18 Sep 2012 02:36 PM
Just re-read the script and they are right this would work...

function OnTouched()
game.Workspace.EnergyBridge.EnergyPlatform.CanCollide = true
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(1)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
wait(6)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(1)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
game.Workspace.EnergyBridge.EnergyPlatform.CanCollide = false
end

script.Parent.Touched:connect(OnTouched)
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 02:39 PM
wait() makes it wait for .0030 of a second. No need for the 1.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
18 Sep 2012 02:42 PM
@spicy. Well wait() is about near 0.003, but it's frame. It really matters, because wait() is relative, as it's longer when your frame rate drops.
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 02:44 PM
Also, someone else game me a (1) time script and it didn't work.
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
18 Sep 2012 03:03 PM
You obviously messed up something in the script, or else it would work.
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 03:17 PM
Yeah, clearly. Why else would I put it up here? I have checked through the syntax and there are no mistakes there.
Report Abuse
spicyhunter3 is not online. spicyhunter3
Joined: 30 Dec 2009
Total Posts: 312
18 Sep 2012 03:48 PM
Bump. Sorry.
Report Abuse
TheUnstable is not online. TheUnstable
Joined: 16 Jun 2011
Total Posts: 83
18 Sep 2012 05:09 PM
Maybe the mistake isn't your script... Maybe some other script is interfering with it, or you didn't name something properly. (Maybe you deactivated the script, too - That happens to me ;))

try this: In your Workspace, place a brick named "ThePart". Insert the following script inside a script loceted in Workspace.

function OnTouched(hit)
game.Workspace.ThePart.CanCollide = true
game.Workspace.ThePart.Transparency = 0.8
wait()
game.Workspace.ThePart.Transparency = 0.6
wait(6)
game.Workspace.ThePart.Transparency = 0.8
wait()
game.Workspace.ThePart.Transparency = 1
game.Workspace.ThePart.CanCollide = false
end

game.Workspace.ThePart.Touched:connect(OnTouched)


If it works, then the script is correct. Copy it, replace the "game.Workspace.ThePart" with the appropriate path for your original brick, and try it!
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
18 Sep 2012 05:11 PM
function onhit(hit)

game.Workspace.EnergyBridge.EnergyPlatform.CanColide = true
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(2)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.6
wait(6)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 0.8
wait(2)
game.Workspace.EnergyBridge.EnergyPlatform.Transparency = 1
game.Workspace.EnergyBridge.EnergyPlatform.CanColide = false

script.Parent.Touched:connect(hit)
Report Abuse
TheUnstable is not online. TheUnstable
Joined: 16 Jun 2011
Total Posts: 83
18 Sep 2012 05:12 PM
Nota Praeter: If you re-read the scripts others wrote to try and help you, you will notice that most of them use "script.Parent.Touched". If your script isn't a direct child of the part you want to be affected by the script, they won't work. I fixed it in the script I just submitted.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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