|
| 09 Aug 2011 08:08 AM |
So it's the meaning this brick will move 15 studs when you click it and then making it to stand still even when clicked on it the problem with this script
debounce = true function onClicked() for i = 1, 10 do if debounce then wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) debounce = false end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
it makes it only move one stud how can i solve this (i want it to move not to teleport) |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:14 AM |
| Repeatedly copy the script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) lines 14 times. The reason my autosignature isn't up is because I'm at a friends house, and I'm not using Google Chrome. Big problem. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:16 AM |
| hmmm... probarly it'll be the best |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:17 AM |
| nope doesn't work it teleports to the point |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:18 AM |
| Don't feel bad, its probably my fault. I don't CFrame with scripts very often o my skills are a bit...rusty. |
|
|
| Report Abuse |
|
|
Nartle
|
  |
| Joined: 29 Mar 2008 |
| Total Posts: 7202 |
|
|
| 09 Aug 2011 08:19 AM |
wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1)
14 more times? |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:20 AM |
| no problem i think i know how to do it your way putting wait(0.1) between all of them going to try that. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:21 AM |
| Oh sry was typing didn't see you posted yes i'm going to try that :3 |
|
|
| Report Abuse |
|
|
Nartle
|
  |
| Joined: 29 Mar 2008 |
| Total Posts: 7202 |
|
|
| 09 Aug 2011 08:21 AM |
If it works, YAY :D
I have barely any idea how to do this stuff, but editing seems to be so easy XD |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:22 AM |
| Yeah this works thx for i all the help.;) |
|
|
| Report Abuse |
|
|
Nartle
|
  |
| Joined: 29 Mar 2008 |
| Total Posts: 7202 |
|
| |
|
|
| 09 Aug 2011 08:32 AM |
You didn't have to do that. See the problem was it made debounce false BEFORE the end of the if statement:
for i = 1, 10 do if debounce then wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) debounce = false end
This would have moved it one stud and then, since debounce is now false, would not have moved it anymore. Replace that in the script with this:
for i = 1, 10 do if debounce then wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) end debounce = false |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Aug 2011 08:37 AM |
Scratch that. It should be after BOTH of those ends like this:
for i = 1, 10 do if debounce then wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) end end debounce = false |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:40 AM |
But my final script is supposen to look like this and i don't know where to put the debounce = false then
function onClicked() for i 1, 10 do if debounce then wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1)--14x debounce = false else wait(0.1) script.Parent.CFrame = script.Parent.CFrame - Vector3.new(0, 0, 1) end end end debounce = true-- this position? script.Parent.ClickDetector.MouseClick:connect(onClicked)
Should this be correct then? |
|
|
| Report Abuse |
|
|
Nartle
|
  |
| Joined: 29 Mar 2008 |
| Total Posts: 7202 |
|
|
| 09 Aug 2011 08:43 AM |
Whoa >_>
Can I get this in instead of click, but on touch? :3 |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:45 AM |
Yeah you can change the first line function onTouch last line: script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:48 AM |
| Wait I don't understand. You're trying to make it so when you click the script that it moves 15 studs. Then when you click it again, you want it to move back to where it was before? |
|
|
| Report Abuse |
|
|
| |
|
|
| 09 Aug 2011 08:49 AM |
| Because that's what it looks like from the script. |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:53 AM |
Okay, then:
function onClicked() if (debounce == true) then for i=1, 15 do wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) end debounce = false elseif (debounce == false) then for i=1, 15 do wait(0.1) script.Parent.CFrame = script.Parent.CFrame - Vector3.new(0, 0, 1) end debounce = true end end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:54 AM |
Oh, sorry. One more thing:
debounce = true
function onClicked() if (debounce == true) then for i=1, 15 do wait(0.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0, 1) end debounce = false elseif (debounce == false) then for i=1, 15 do wait(0.1) script.Parent.CFrame = script.Parent.CFrame - Vector3.new(0, 0, 1) end debounce = true end end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:55 AM |
| Umm ok thx i'm going to test |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2011 08:58 AM |
| Sry to say but the script isn't working |
|
|
| Report Abuse |
|
|
Nartle
|
  |
| Joined: 29 Mar 2008 |
| Total Posts: 7202 |
|
|
| 09 Aug 2011 09:00 AM |
It is for me, I just have one problem with it.
Every single time I touch it it speeds up, the more I touch it the faster it speeds up XD |
|
|
| Report Abuse |
|
|