-
What do you want to achieve? Keep it simple and clear!
I am attempting a fireball and I am trying to get it to spin. -
What is the issue? Include screenshots / videos if possible!
However, when I tween one of the parts to make it spin on the z-axis it will tween the orientation of the y-axis instead. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried switching the tween to different axis but those axis will spin the right way. For example, since the z-axis is spinning the y-axis, I tried changing the tween to the y-axis but that works and spins the y-axis like it should. Basically, x-axis spins correct, y-axis spins correct, but z-axis spins the y-axis so there is essentially no z-axis.
Code:
local rp = game:GetService(“ReplicatedStorage”)
local Fireball = rp:WaitForChild(“Fireball”)
local Debris = game:GetService(“Debris”)
local TweenService = game:GetService(“TweenService”)
local Animations = script:WaitForChild(“Animations”)
local Meshes = script:WaitForChild(“Meshes”)
local debounce = false
local speed = 1
local Damage = 10
Fireball.OnServerEvent:Connect(function(Player)
Fireball:FireClient(Player)
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Humrp = Character:WaitForChild("HumanoidRootPart")
local cast = Character:WaitForChild("Humanoid"):LoadAnimation(Animations:WaitForChild("Fireball"))
cast:Play()
wait(.65)
local effectsFold = Instance.new("Folder",workspace)
effectsFold.Name = Player.Name.." Effects"
Debris:AddItem(effectsFold,2)
local Fireballs = Meshes:WaitForChild("Fireball"):Clone()
Fireballs.CFrame = Humrp.CFrame * CFrame.new(0,0,-5)
Fireballs.Orientation = Fireballs.Orientation + Vector3.new(0,180,0)
Fireballs.Parent = effectsFold
local Drag = Meshes:WaitForChild("Drag"):Clone()
Drag.CFrame = Fireballs.CFrame * CFrame.new(0,.5,-2)
Drag.Orientation = Drag.Orientation + Vector3.new(-90,0,0)
Drag.Parent = effectsFold
local Spin = Meshes:WaitForChild("Spin"):Clone()
Spin.CFrame = Fireballs.CFrame
Spin.Orientation = Spin.Orientation + Vector3.new(90,0,0)
Spin.Parent = effectsFold
local weld = Instance.new("ManualWeld")
weld.Part0 = Fireballs
weld.Part1 = Drag
weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
local weld = Instance.new("ManualWeld")
weld.Part0 = Drag
weld.Part1 = Spin
weld.C0 = weld.Part0.CFrame:toObjectSpace(weld.Part1.CFrame)
weld.Parent = weld.Part0
local Tween = TweenService:Create(Drag,TweenInfo.new(2),{Orientation = Drag.Orientation + Vector3.new(0,0,360)}):Play()
local Vel = Instance.new("BodyVelocity",Fireballs)
Vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
Vel.Velocity = Humrp.CFrame.lookVector * speed
Fireballs.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= Player.Name and debounce == false then
debounce = true
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - Damage
wait(1)
debounce = false
end
end)
end)