Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help to move a sphere from one place to another. Anyone?

Asked by 6 years ago

Things you should know: –Workspace ––Script (script is below) ––FirstFirePositions –––FirstFirePosition1 –––FirstFirePosition2 –––FirstFirePosition3 –––FirstFirePosition4 ––FireSpirit –––Humanoid –––Head (this is the sphere i want to move)

Script:

local NPC = script.Parent.FireSpirit































while true do 
    wait()
    NPC.Humanoid:MoveTo(script.Parent.FirstFirePositions.FirstFirePosition1.Position)
    NPC.Humanoid.MoveToFinished:wait()
    wait(0)
    NPC.Humanoid:MoveTo(script.Parent.FirstFirePositions.FirstFirePosition2.Position)
    NPC.Humanoid.MoveToFinished:wait()
    wait(0)
    NPC.Humanoid:MoveTo(script.Parent.FirstFirePositions.FirstFirePosition3.Position)
    NPC.Humanoid.MoveToFinished:wait()
    wait(0)
    NPC.Humanoid:MoveTo(script.Parent.FirstFirePositions.FirstFirePosition4.Position)
    NPC.Humanoid.MoveToFinished:wait()
    wait(0)


end

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
6 years ago

Use TweenService. TweenService is kinda complicated, but basically, you insert the name of the part, the TweenInfo, and the Value you want to change as well as what you want to change it to. I'll show you an example below.

--Put this into a block and it will move it 10 blocks above itself in 5 seconds.

local TweenService = game:GetService("TweenService")

local Block = script.Parent
--Getting the block
local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
--The TweenInfo. The first Part is the number of seconds it'll take, the second part is the EasingStyle, and the Third Part is the EasingDirection. I'll provide links below to both.
local newPosition = {["Position"] = Block.Position + Vector3.new(0,10,0)}
--The part in brackets is the value, and the second part is how the value will be changed.

local Tween = TweenService:Create(Block, Info, newPosition)
Tween:Play()
--Creating the Tween and starting it.

TweenService is used in many games that use a lot of effects, smooth animations, or moving objects. Here's more links you may need:

EasingStyle

EasingDirection

0
I don't understand and I have a bigger problem, tweening can only go to one position and back to the one at the start, I want to do it to move to four locations. SuperBeeperman 30 — 6y
Ad

Answer this question