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
|
  |
| Joined: 27 Jan 2011 |
| Total Posts: 630 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 27 Jan 2011 |
| Total Posts: 630 |
|
|
| 02 May 2015 07:03 AM |
| then change pos by .01 or something lol |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 02 May 2015 07:04 AM |
| Bodymover. Alternatively use the delta from wait |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 03 May 2015 08:39 AM |
| k brb ima fix tht in a min |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 03 May 2015 08:53 AM |
| Try using interpolation. ModuleMaker has an interpolation module that surely meets your needs. |
|
|
| Report Abuse |
|
|
|
| 03 May 2015 08:55 AM |
| Is this a touch brick or other? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| Joined: 13 Nov 2010 |
| Total Posts: 5841 |
|
|
| 03 May 2015 09:04 AM |
| Its a brick that moves any humanoid it touches. |
|
|
| Report Abuse |
|
|
|
| 03 May 2015 09:07 AM |
| My scripts works for it then |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|