Hi, im creating a simple fireball which fires at the pos of the mouse, howerver the part stopps mid air for abt 0.3 secs before it actually starts to move.
Local Script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local tool = script.Parent
tool.Activated:Connect(function()
ReplicatedStorage.Shoot:FireServer(Mouse.Hit.Position)
end)
Server Script:
local tool = script.Parent
local handle = tool.Handle
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
handle.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
print("fireball equipped")
end
end)
tool.Activated:Connect(function(hit)
local fireball = Instance.new("Part")
--fireball properties here--
ReplicatedStorage.Shoot.OnServerEvent:Connect(function(player,mousePos)
local bodyVelocity = Instance.new("BodyVelocity")
local char = player.Character
local HRP = char:FindFirstChild("HumanoidRootPart")
bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bodyVelocity.Velocity = (mousePos - HRP.Position).Unit * 100
bodyVelocity.Parent = fireball
fireball.Parent = workspace
end)
end)