local part=script.Parent
for i=1,50 do
part.Position=part.Position+Vector3.new(0,0,3)
wait(0.3)
end
How would I make a floating effect out of this moving script I made?
2 answers
If you mean as if its levitating up and down then I recommend to try this (i havent tested it lol)
local part = script.Parent
while wait() do
for i = 1, 200 do
wait(i/1800)
part.Position = part.Position + Vector3.new(0,.025,0)
if i == 100 then
break
end
end
for i = 1, 200 do
wait(i/1800)
part.Position = part.Position + Vector3.new(0,-.025,0)
if i == 100 then
break
end
end
end
2 comments
why would you wait(i/1800)? and why the i==100 break thing? Why not just use for i=1,100 do?
This works, thank you!!!!
MultipleHeadshots is wrong, you must use CFrame:
part = script.Parent
while true do
for i = 1, 200 do
wait(0.1)
part.Position.CFrame = CFrame.new(part.Position + Vector3.new(0,.2,0))
if i == 100 then
break
end
end
for i = 1, 200 do
wait(0.1)
part.Position.CFrame = CFrame.new(part.Position + Vector3.new(0,-.2,0))
break
end
end
end
Using CFrame + Vector3 performs the slide because the CFrame constructor is adjusting the Part's Position so that it levitates. Without CFrame the levitation would look really blocky. (And, MultipleHeadshots, just for the credit, local variables were deprecated so that the are only usable within their native code block. This happened 3 years ago when Roblox upgraded to Lua 5.1.)
2 comments
what
Vector3 works just fine.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
instead of 0,0,3 you do 0,3,0
Explanation?