It seems when you click the fireball it just stays in one spot and goes up, not stay up and go in the direction you clicked. Also, the touch event doesn't seem to stop the fireball from damaging the creator. Are there any problems? I am really clueless, I am currently just trying to build the basics of the fireball so I can eventually add it to a game, thus adding effects to it.
Local script
local tool =script.Parent
local player = tool.Parent.Parent
local event = tool.Event
local Mouse = player:GetMouse()
--local damage = --Future Thing
tool.Equipped:connect(function(equip)
equip.Button1Down:connect(function(mouse)
print("Clicked")
local distance = (player.Character.Torso.Position - Mouse.Hit.p).Magnitude
if distance >= 5 then
event:FireServer()
print("Fired")
game.Workspace:WaitForChild("FireBall").Touched:connect(function(hit)
if hit~= nil and not hit.Parent:IsDescendantOf(tool.Parent.Parent) then
local hum = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
if hum ~= nil then
hum:TakeDamage(50)
end
end
end)
end
end)
end)
Server Script
local tool =script.Parent
local player = tool.Parent.Parent
local event = tool.Event
local Mouse = player:GetMouse()
event.OnServerEvent:connect(function()
local part = Instance.new("Part")
part.Parent = game.Workspace
part.Name = "FireBall"
part.Shape = "Ball"
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
part.BrickColor = BrickColor.new("Red")
part.Size = Vector3.new(5,5,5)
part.Transparency = 1
part.CFrame = player.Character.Torso.CFrame +Vector3.new(0,0,-5)
part.CanCollide = false
--Add Affects
local fire = Instance.new("Fire")
fire.Name = "FIRE"
fire.Parent = part
fire.Size = 100
local force = Instance.new("BodyVelocity")
force.MaxForce = Vector3.new(50, 50, 50)
force.Parent = part
end)

1 comment
The script is 100% fixed, try it out!(The fire ball moves to where you clicked. If it you click on the floor it will go through the floor). Read the edit in my answer.