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: Moving a different block (HELP)

Previous Thread :: Next Thread 
legotesting123 is not online. legotesting123
Joined: 22 Jan 2010
Total Posts: 2315
16 Oct 2013 05:52 PM
local b = Model.findFirstChild("S")

function onTouched()

b.CFrame = Vector3.new(0, 5, 0)
wait(5)
b.Cframe = Vector3.new(0,5,0)
end

script.Parent.Touched:connect(onTouched)

I want to move a block by stepping on another block.

why isn't this working?

Interior Crocodile Alligator
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
16 Oct 2013 06:14 PM
local b = Model.findFirstChild("S")

function onTouched()
if b then -- check if "b" is really there. Can prevent errors.
b.CFrame = b.CFrame + Vector3.new(0, 5, 0)
wait(5)
b.Cframe = b.CFrame + Vector3.new(0, 5,0)
end
end
script.Parent.Touched:connect(onTouched)

You can't construct a CFrame using Vector3. You can do operations with it, though.
Report Abuse
legotesting123 is not online. legotesting123
Joined: 22 Jan 2010
Total Posts: 2315
16 Oct 2013 06:15 PM
local b = script.Parent.Parent:FindFirstChild("S")

function onTouch()

b.CFrame = Vector3.new(0, 5, 0)
wait(5)
b.Cframe = Vector3.new(0,5,0)
end

script.Parent.Touched:connect(onTouch)

This still won't work, hopingly it would;ve

Interior Crocodile Alligator
Report Abuse
legotesting123 is not online. legotesting123
Joined: 22 Jan 2010
Total Posts: 2315
16 Oct 2013 06:17 PM
Thanks so much.

Interior Crocodile Alligator
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
16 Oct 2013 06:17 PM
local b = script.Parent.Parent:FindFirstChild("S")

function onTouched()
if b then -- check if "b" is really there. Can prevent errors.
b.CFrame = b.CFrame + Vector3.new(0, 5, 0)
wait(5)
b.Cframe = b.CFrame + Vector3.new(0, 5,0)
end
end

script.Parent.Touched:connect(onTouched)

I suppose you can try this, too.
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
16 Oct 2013 06:17 PM
Wait, did it work?
Report Abuse
legotesting123 is not online. legotesting123
Joined: 22 Jan 2010
Total Posts: 2315
16 Oct 2013 06:27 PM
local b = script.Parent.Parent:FindFirstChild("S")

function onTouched()
if b then

b.CFrame = b.CFrame + Vector3.new(0,-5, 0)

script.Disable = true

wait(1)

script.Disable = false

b.Cframe = b.CFrame + Vector3.new(0,5,0)

end
end
script.Parent.Touched:connect(onTouched)

I was actually going for this, sorry, I didn't want the player to spam the button.

Interior Crocodile Alligator
Report Abuse
legotesting123 is not online. legotesting123
Joined: 22 Jan 2010
Total Posts: 2315
16 Oct 2013 06:28 PM
But then again, this doesn't bring the block back up.

Interior Crocodile Alligator
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
16 Oct 2013 06:47 PM
b.CFrame = b.CFrame + Vector3.new(0, 5, 0)
wait(5)
b.Cframe = b.CFrame + Vector3.new(0, -5,0)
Report Abuse
legotesting123 is not online. legotesting123
Joined: 22 Jan 2010
Total Posts: 2315
16 Oct 2013 06:49 PM
thanks, it works now.

Interior Crocodile Alligator
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