i'm trying to make the player when press key f he will do the throwing animation and then throw a fire ball and it will deal damage to what it hits, and it worked but there's a problem sometime it doesn't damage at all and specially when i'm walking and throwing at the same time it doesn't deal damage at all , i tried to make the ball smaller and it actually worked the ball damaged normally as i want it but when the fireball size was big it didn't damage , i start testing and i think that's when the ball hit more than one thing (part) the script work normally and the ball deal damage but when the ball was big it was hitting more than one thing (part) at once and that what stopped it from dealing damage , i think that the problem but please check my code and help me.
1) Local Script inside (StarterPack) :
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RemoteEvent = game.Workspace.remoteEvents.fireLine
local RemoteEvent2 = game.Workspace.remoteEvents.fireLine2
local UIS = game:GetService("UserInputService")
local Debounce = false
UIS.InputBegan:connect(function(Input,mouse, x, y, z)
local char = Player.Character
if Input.KeyCode == Enum.KeyCode.F then
--wait(1)
if Debounce == true then return end
Debounce = true
if script.level.Value == 1 then
local roll = Instance.new("Animation")
roll.AnimationId = "http://www.roblox.com/asset/?id=2393690494"
local animloader = char.Humanoid:LoadAnimation(roll)
animloader:Play()
wait(0.8)
mouse = Mouse.Hit
x = Mouse.Hit.p.x
y = Mouse.Hit.p.y
z = Mouse.Hit.p.z
RemoteEvent:FireServer(mouse, x, y, z)
end
if script.level.Value == 2 then
mouse = Mouse.Hit
x = Mouse.Hit.p.x
y = Mouse.Hit.p.y
z = Mouse.Hit.p.z
RemoteEvent2:FireServer(mouse, x, y, z)
end
wait(1)
Debounce = false
end
end)
2) Script inside (Workspace) :
Instance.new("BodyPosition", workspace)
game.Workspace.remoteEvents.fireLine.OnServerEvent:Connect(function(Player,mouse, x, y, z)
local AlreadyTouched = false
local Character = Player.Character or Player.CharacterAdded:wait()
local FireLine = game.ReplicatedStorage.Kai.FireLine:Clone()
FireLine.CanCollide = false
FireLine.Parent = Character
FireLine.CFrame = Character.HumanoidRootPart.CFrame*CFrame.new(-1.5,1,-3)
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = (FireLine.Position - mouse.p).unit * -175
BV.Parent = FireLine
FireLine.Touched:Connect(function(Hit)
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
--if Humanoid == nil then Humanoid = Hit.Parent.Parent:FindFirstChild("Humanoid") end
print(Hit.Name)
--print("Hit.Parent.Parent: " , Hit)
if Humanoid == nil and Hit.Name ~= "Terrain" then FireLine:Destroy() end
if AlreadyTouched == false and Hit.Name ~= "Terrain" then
AlreadyTouched = true
if Humanoid.Parent.Name == Player.Name then
Humanoid.Health = Humanoid.Health
else
Humanoid.Health = Humanoid.Health - Humanoid.MaxHealth/4
FireLine:Destroy()
end
end
end)
wait(2)
FireLine:Destroy()
end)

4 comments
Man your a legend , thank you so much it worked perfectly
no probs! Also remember to accept my answer if u can- ohnvm who cares xd
ah rip, good answer but not market correct, sad, eh, the least I could do is upvote.
sure, i dont mind, at least I could help!