|
| 12 Apr 2015 11:40 PM |
I am new to scripting and i would like to script a detector that would slide something then when the detector is not being touched it would go back the way it was before
this is the script im using to slide it to the first position:
keyboard = script.Parent.Parent.KeyBoard plank = script.Parent.Parent.Plank screen = script.Parent.Parent.Screen.Decal debounce= true
function onTouched(touch) if debounce == true then debounce = false for i=1,4 do keyboard.CFrame = CFrame.new(keyboard.CFrame.x + 0.5,keyboard.CFrame.y,CFrame.z) plank.CFrame = CFrame.new(plank.CFrame.x + 0.5,plank.CFrame.y, plank.CFrame.z) screen.Transparency = 0 wait() end debounce = true end end
script.Parent.Touched:connect(onTouched)
Please Help! |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 11:41 PM |
| just add a free model kohl's admin script and you're set! |
|
|
| Report Abuse |
|
|
| |
|
|
| 12 Apr 2015 11:44 PM |
| I don't want to add free models i want to learn how to do this properly |
|
|
| Report Abuse |
|
|
aaron0v
|
  |
| Joined: 08 Jun 2010 |
| Total Posts: 1264 |
|
|
| 12 Apr 2015 11:46 PM |
| there's a scripting forum for a reason. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 11:47 PM |
There is an OnTouchEnded event, but it's rather unreliable. I'd recommend using invisible, non-collidable parts that detect when touched to trigger exiting. |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 11:50 PM |
| Try making them local variables |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 11:53 PM |
May I point out that there is no space on "debounce= true" at the top.
|| QUIT || +24284 posts || Uberbuilder98 +others || |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 11:54 PM |
Also use local variables like the other guy said "Local keyboard = script.Parent.Parent.KeyBoard"
|| QUIT || +24284 posts || Uberbuilder98 +others || |
|
|
| Report Abuse |
|
|
|
| 12 Apr 2015 11:54 PM |
@breaking Spaces like that dont affect anything |
|
|
| Report Abuse |
|
|
| |
|