Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i make this part tween based on the direction the player is looking?

Im trying to make the part tween outwards towards the direction the player is looking, it works when i face the direction the player faces when spawning but whenever i face any other direction if messes up

local rp = game:GetService("ReplicatedStorage")
local Fireball = rp:WaitForChild("Events"):WaitForChild("Fire"):WaitForChild("FlameWall")

local Animations = script:WaitForChild("Animations")
local Meshes = script:WaitForChild("Meshes")

local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")

local speed = script:GetAttribute("Speed")
local Damage = script:GetAttribute("Damage")

Fireball.OnServerEvent:Connect(function(Player,direction)
	local Character = Player.Character
	local Humanoid = Character:WaitForChild("Humanoid")
	local humrp = Character:WaitForChild("HumanoidRootPart")
	
	local effectsFold = Instance.new("Folder",workspace)
	effectsFold.Name = Player.Name.." Effects"
	Debris:AddItem(effectsFold,6)
	
	local FB = Meshes:WaitForChild("Wall"):Clone()
	FB.Size = Vector3.new(1,0.1,1)
	FB.CFrame = humrp.CFrame * CFrame.new(0,-3,-4)
	FB.Orientation = FB.Orientation + Vector3.new(0,0,0)
	FB.Parent = effectsFold
	
	local Egoal = {}
	Egoal.Size = FB.Size + Vector3.new(15,0.3,60)
	Egoal.Position = FB.Position + Vector3.new(0,0,-30)
	local Einfo = TweenInfo.new(1)
	local Etween = TweenService:Create(FB,Einfo,Egoal)
	Etween:Play()
end)

1 comment

0

u are trying to make a script that will shoot the fireball to the player’s look vector? im kinda confusing on the title

1 answer

u can make the fireball orientation = player humanoid root part.Orientation and use velocity instead of tween service? u can use the look vector with velocity to shoot it towards the direction the fireball is facing, then u can destroy it( im not a pro and i may don’t understand your problem, maybe its because some complicated stuff that u don’t use this method)

3 comments

0

Velocity comes with problems, tweens will be fine if you destroy the fireball later or if it hits something. You can also use lookvector instead of orientation.

0

thanks bro i will remember that

0

Its not actually a fireball, the ability creates a small field of fire infront of the player that expands. the problem is that if im facing the opposite way of the way the player was facing when they spawned it will expand out behind the player and even hit them

This discussion is preserved as it was. New answers, comments, and votes are closed.