-
What do you want to achieve? a script that shoots a fireball and does damage when it hits a player
-
What is the issue? the damaging part of the script fires whenever, not when it touches a player
-
What solutions have you tried so far? none since I don’t understand
here’s the script
local replicatedStorage = game:GetService("ReplicatedStorage")
replicatedStorage.WandaRemotes.WandaBlast.OnServerEvent:Connect(function(player, position)
local character = player.Character
local blast = replicatedStorage.WandaPowers.WandaBlast:Clone()
blast.Parent = workspace
blast.Position = character.HumanoidRootPart.Position + Vector3.new(0,0,-1)
local explosion = replicatedStorage.WandaPowers.WandaHit:Clone()
local bv = Instance.new("BodyVelocity")
bv.Velocity = CFrame.new(blast.Position, position).LookVector * 75
bv.Parent = blast
blast.Touched:Connect(function(hit)
if hit.Parent.Name == player.Name then return end
if hit.Parent.Humanoid then
hit.Parent.Humanoid:TakeDamage(10)
end
blast:Destroy()
explosion.Position = blast.Position
explosion.Parent = workspace
wait(0.1)
for i = 1, 10 do
wait(0.1)
explosion.Attachment.b.Rate -= 3
explosion.Attachment.c.Rate -= 3
end
wait(1)
explosion:Destroy()
end)
end)
please note that players have custom 3d clothing on them that are placed inside of accessories (pretty much meshes that stick onto the player with WeldConstraints and they’re non-collidable with canTouch set to false) here’s what it looks like: