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: This script won't even give me an output message. Help?

Previous Thread :: Next Thread 
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
17 Aug 2011 03:03 PM
Basically it starts out by checking if the script is already running through the Activated value, then proceeds to move the part 22 studs.

The thing is, I can't even get it to print out the "Touched" message so I'm guessing there's something wrong with structure.

function onTouched()
print("Touched")
if script.Parent.Activated.Value = false then
script.Parent.Activated.Value = true
print("About to move")
for i=1, 22 do
script.Parent.CFrame = script.Parent.CFrame.X - 1
wait(1)
end
print("Done")
end

script.Parent.Touched:connect(onTouched)
Report Abuse
Fl0x is not online. Fl0x
Joined: 06 Aug 2010
Total Posts: 5169
17 Aug 2011 03:05 PM
script.Parent.CFrame = script.Parent.CFrame.X - 1
Error thar
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
17 Aug 2011 03:05 PM
Hey, I know you from another website. ;)

I only see two ends in there. There needs to be three.
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
17 Aug 2011 04:36 PM
"script.Parent.CFrame = script.Parent.CFrame.X - 1"

How exactly would I write it?

~roblox.com/CotF-item?id=370141
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
17 Aug 2011 04:53 PM
Bump. I've added a third end but it still doesn't seem to be reacting at all.

~roblox.com/CotF-item?id=370141
Report Abuse
Ganondude is not online. Ganondude
Joined: 22 Jun 2007
Total Posts: 1175
17 Aug 2011 04:56 PM
If you want to set a part's CFrame you must set it to a value of type CFrame; you are attempting to set a part's CFrame to a single number.
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
17 Aug 2011 04:58 PM
if script.Parent.Activated.Value = false then --you need two '=' characters
Report Abuse
Riderj is not online. Riderj
Joined: 15 Aug 2011
Total Posts: 1534
17 Aug 2011 05:07 PM
CFrame.X is read only, you would use

script.Parent.CFrame*CFrame.new(1,0,0)
Report Abuse
Decoration is not online. Decoration
Joined: 29 Jun 2011
Total Posts: 322
17 Aug 2011 05:18 PM
'if script.Parent.Activated.Value = false then'

Should be:

'if script.Parent.Activated.Value == false then'
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
17 Aug 2011 05:26 PM
Here's how my script is turning out so far:

function onTouched()
print("Touched")
if script.Parent.Activated.Value == false then
script.Parent.Activated.Value = true
print("About to move")
for i=1, 22 do
script.Parent.CFrame = script.Parent.CFrame + CFrame.new(1,0,0)
wait(1)
end
print("Done")
end
end

script.Parent.Touched:connect(onTouched)


Like was pointed out I had overlooked the double equal signs, but I'm still not really sure how I'd make it so script.Parent.CFrame = script.Parent.CFrame + 1 to the X vector.

Here's what is says in the output:

Workspace.Part.Script:7: bad argument #3 to '?' (CFrame expected, got number)
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
17 Aug 2011 05:38 PM
bump

~roblox.com/CotF-item?id=370141
Report Abuse
Ganondude is not online. Ganondude
Joined: 22 Jun 2007
Total Posts: 1175
17 Aug 2011 06:07 PM
You can't add two CFrames, but you can add a Vector3 to a CFrame to translate the CFrame along world coordinates. For example,

part.CFrame = part.CFrame + Vector3.new(1,0,0)

This line would move part by 1 unit along the global x-axis.
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
17 Aug 2011 06:14 PM
Thanks for the help, I think I've got it working.


/Thread Closed

~roblox.com/CotF-item?id=370141
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