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 » Scripters
Home Search
 

Re: Simple moving script

Previous Thread :: Next Thread 
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
02 May 2015 07:00 AM
local offset = 0 --How many studs to teleport in front
local db = false
x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0,10,-offset)
end
end
db = false
end)

This script instantly teleports a player 10 studs above, instead, how do I make it move the player 10 studs above smoothly?
Report Abuse
Vexture is not online. Vexture
Joined: 27 Jan 2011
Total Posts: 630
02 May 2015 07:00 AM
try + instead of *
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
02 May 2015 07:00 AM
Use a for loop

e.g.

for i=1,10 do
CHANGE POS BY 1
end
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
02 May 2015 07:01 AM
@Yobo, I know this may work, but it will rise 1 stud each second, it wont go smoothly.
Report Abuse
Vexture is not online. Vexture
Joined: 27 Jan 2011
Total Posts: 630
02 May 2015 07:03 AM
then change pos by .01 or something lol
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
02 May 2015 07:04 AM
Bodymover. Alternatively use the delta from wait
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 08:35 AM
So this should be the modified script but its still not working properly...

x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
for i = 0.01, 10 do
local db = false
x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
end
end
db = false
end)
end
end
end
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 08:36 AM
x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
for i = 0.01, 10, +1 do
local db = false
x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
end
end
db = false
end)
end
end
end
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 08:37 AM
I mean

x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
for i = 0.01, 10, +0.01 do
local db = false
x.Touched:connect(function(hit)
if db == false then db = true
if hit.Parent:FindFirstChild('Humanoid') then
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
end
end
db = false
end)
end
end
end
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 08:39 AM
Still not working.

Output: Players.Player.Backpack.Tool.LocalScript:66: unexpected symbol near '+'
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 08:39 AM
k brb ima fix tht in a min
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 08:45 AM
local debounce = false
local x = script.Parent
local num = 0

x.Touched:connect(function(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if debounce == false and humanoid~= nil then
debounce = true
while num < 10 do
wait()
num = num + .5
humanoid.Parent.Torso.CFrame = humanoid.Parent.Torso.CFrame * CFrame.new(0,num,0)
wait(2)
debounce = false
end
end
end)
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 08:47 AM
local debounce = false
local x = script.Parent
local num = 0

x.Touched:connect(function(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if debounce == false and humanoid~= nil then
debounce = true
while num < 10 do
wait()
num = num + .5
humanoid.Parent.Torso.CFrame = humanoid.Parent.Torso.CFrame * CFrame.new(0,num,0)
wait()
debounce = false
end
end
end)

-- I made it smoother
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 08:50 AM
Still not working X(
There is no Output problem for some reason...
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
03 May 2015 08:53 AM
Try using interpolation. ModuleMaker has an interpolation module that surely meets your needs.
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 08:55 AM
Is this a touch brick or other?
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 09:02 AM
local debounce = false
local x = script.Parent
local num = 0

x.Touched:connect(function(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if debounce == false and humanoid~= nil then
debounce = true
while num < 10 do
wait()
num = num + .5
humanoid.Parent.Torso.CFrame = humanoid.Parent.Torso.CFrame * CFrame.new(0,num,0)
end
wait(2)
debounce = false
num = 0
end
end)

-- Now it works
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 09:04 AM
Its a brick that moves any humanoid it touches.
Report Abuse
crazymuffin267 is not online. crazymuffin267
Joined: 01 Aug 2012
Total Posts: 253
03 May 2015 09:07 AM
My scripts works for it then
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 12:17 PM
The output isnt helping, and its not working for some unknown reason, so I made a code but even this code seems not to work:

x.Touched:connect(function(hit)
local Humanoid = hit.Parent:findFirstChild("Humanoid")
if Humanoid then
while true do
i = 0 + 0.01
if i == 10 then
break
end
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0,i,0)
end
end
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 12:45 PM
New code:

x.Touched:connect(function(hit)
local Humanoid = hit.Parent:findFirstChild("Humanoid")
if Humanoid then
while true do
i = 0 + 0.01
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
if i == 10 then
i = 10 - 0.01
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
end

end
end
Report Abuse
9draco is not online. 9draco
Joined: 13 Nov 2010
Total Posts: 5841
03 May 2015 12:52 PM
Whoops, this is the one:

x.Touched:connect(function(hit)
local Humanoid = hit.Parent:findFirstChild("Humanoid")
if Humanoid then
repeat i = 0 + 0.01 until
i == 10
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
if i == 10 then
repeat i = 10 - 0.01 until
i == 0
hit.Parent.Torso.CFrame = hit.Parent.Torso.CFrame * CFrame.new(0, i, 0)
end

end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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