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: Could someone help me to fix this script?

Previous Thread :: Next Thread 
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
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
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:16 AM
hmmm... probarly it'll be the best
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:17 AM
nope doesn't work it teleports to the point
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
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 is not online. 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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
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 is not online. 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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:22 AM
Yeah this works thx for i all the help.;)
Report Abuse
Nartle is not online. Nartle
Joined: 29 Mar 2008
Total Posts: 7202
09 Aug 2011 08:24 AM
xD
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:35 AM
Hmmm... OK then.
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
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 is not online. 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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:45 AM
Yeah you can change the first line
function onTouch
last line:
script.Parent.Touched:connect(onTouched)
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:49 AM
Yupz
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
09 Aug 2011 08:49 AM
Because that's what it looks like from the script.
Report Abuse
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
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
ChaosStar95 is not online. ChaosStar95
Joined: 19 Feb 2009
Total Posts: 5943
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
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:55 AM
Umm ok thx i'm going to test
Report Abuse
demonskul777 is not online. demonskul777
Joined: 28 May 2010
Total Posts: 3716
09 Aug 2011 08:58 AM
Sry to say but the script isn't working
Report Abuse
Nartle is not online. 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
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