Im trying to make so It goes 5 studs straight from its current position

local UIS = game:GetService(“UserInputService”)
local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()

local hum = Character:WaitForChild(“Humanoid”)
local TornadoPart = game:GetService(“ReplicatedStorage”).Tornado
local debris = game:GetService(“Debris”)

local Anim = Instance.new(“Animation”)
Anim.AnimationId = “rbxassetid://12287682379”
local Animtrack = hum:LoadAnimation(Anim)

UIS.InputBegan:Connect(function(input,gpe)
if input.KeyCode == Enum.KeyCode.Q then
Animtrack:Play()
local TornadoPart = game:GetService(“ReplicatedStorage”).Tornado:Clone()
TornadoPart.Position = plr.Character:WaitForChild(“HumanoidRootPart”).Position
TornadoPart.Anchored = true
TornadoPart.CanCollide = false
TornadoPart.Velocity = Vector3.new(10,10,0)
TornadoPart.Parent = workspace

    debris:AddItem(TornadoPart,2)
end

end)

If you want it to go 5 studs in the direction its pointing at, use this:

part.CFrame += part.CFrame.LookVector * 5

If you want it to move 5 studs in the direction of it’s velocity, use this:

part.Position += part.Velocity / part.Velocity.Magnitude * 5
-- Seems weird to use this though

And why are you setting the velocity of an anchored part?

You are trying to move what to where? and the velocity property?

As @bluebxrrybot said, just use the CFrame, maybe like this?

local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()

local hum = Character:WaitForChild("Humanoid")
local TornadoPart = game:GetService("ReplicatedStorage").Tornado
local debris = game:GetService("Debris")

local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://12287682379"
local Animtrack = hum:LoadAnimation(Anim)

UIS.InputBegan:Connect(function(input,gpe)
	if input.KeyCode == Enum.KeyCode.Q then
		Animtrack:Play()
		local TornadoPart = game:GetService("ReplicatedStorage").Tornado:Clone()
		TornadoPart.CFrame = plr.Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,0,-5)
		TornadoPart.Anchored = true
		TornadoPart.CanCollide = false
		TornadoPart.Velocity = Vector3.new(10,10,0)
		TornadoPart.Parent = workspace

		debris:AddItem(TornadoPart,2)
	end
end)

TYSM just wondering where do i put it do I put it in the tweenservice?

What? You should put it in the script you were just working with.

yes but where located in the script I was working in/

Dont worry nvm Im just dumb lol but tysm anyway/

Do you want it to move on every renderstep?

What is a renderstep I havent learned that yet im a beginner scripter

Something that fires every frame, its part of RunService. (60 frames per second).

Nah Im just a beginner scripter dont wanna get in to that YET.

1 Like

If you were to make it move 5 studs forward every second, it would look like this:

game:GetService("RunService").RenderStepped:Connect(function(dt)
    part.CFrame += part.CFrame.LookVector * 5 * dt
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.