Hello, I've made a simply fire ball script. (Fully FE)
There is a local script inside player's backpack so when player hits the button (x) then it sends a request to remote event to fire.
Server script does all the work. But the main problem lies in Affect Script
I'm not sure how to explain it but I'll try my best :)
When the ball hits the player it should instantly remove but instead of it goes a bit further and then removes. For me it stutters. Somehow it works good in solo mode.
Is there any way to "fix" it? Have you ever had such a problem?
Server script gives the affect script to the ball
Here is the Affect Script:
local ServerStorage = game:GetService("ServerStorage")
local LightExplosion = ServerStorage:WaitForChild("Effects"):WaitForChild("Explosions"):WaitForChild("LightExpl"):Clone()
local DarkExplosion = ServerStorage:WaitForChild("Effects"):WaitForChild("Explosions"):WaitForChild("DarkExpl"):Clone()
local Magic = script.Parent
local Owner = script:WaitForChild("Owner")
local Type = script:WaitForChild("Type")
Magic.Touched:connect(function(Hit) --- HERE IS THE TOUCHED EVENT ---
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
local Torso = Hit.Parent:FindFirstChild("Torso")
--- CHECKS IF THE PLAYER HAS HUMANOID ---
if Humanoid and Humanoid.Health > 0 and Torso and Hit.Parent.Name ~= Owner.Value then
if Type.Value == "DShot1" then
-------
local BodyVel = Magic:FindFirstChild("BodyVelocity"):Clone()
DarkExplosion.Parent = Torso
game.Debris:AddItem(DarkExplosion,0.5)
script.Parent = Hit.Parent
Humanoid:TakeDamage(30)
Magic:remove()--- MAGIC == BALL THAT SHOULD BE REMOVED INSTANTLY AFTER IT TOUCHES SOMETHING ---
wait(0.2)
DarkExplosion.Enabled = false
BodyVel.Parent = Torso
wait(0.1)
BodyVel:remove()
script:remove()
------
end
end
end)

1 comment
Try removing the BodyVel before the wait(.2) and use :Destroy(), :remove() is deprecated.