Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The part isn't removing instantly. [?]

Asked by 8 years ago
Edited 8 years ago

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:

01local ServerStorage = game:GetService("ServerStorage")
02local LightExplosion = ServerStorage:WaitForChild("Effects"):WaitForChild("Explosions"):WaitForChild("LightExpl"):Clone()
03local DarkExplosion = ServerStorage:WaitForChild("Effects"):WaitForChild("Explosions"):WaitForChild("DarkExpl"):Clone()
04 
05local Magic = script.Parent
06local Owner = script:WaitForChild("Owner")
07local Type = script:WaitForChild("Type")
08 
09Magic.Touched:connect(function(Hit) --- HERE IS THE TOUCHED EVENT ---
10 
11local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
12local Torso = Hit.Parent:FindFirstChild("Torso")
13 
14--- CHECKS IF THE PLAYER HAS HUMANOID ---
15if Humanoid and Humanoid.Health > 0 and Torso and Hit.Parent.Name ~= Owner.Value then
View all 33 lines...
0
Try removing the BodyVel before the wait(.2) and use :Destroy(), :remove() is deprecated. Master_JJ 229 — 8y

2 answers

Log in to vote
1
Answered by 8 years ago

First thing, use Destroy() as remove() is deprecated.

http://wiki.roblox.com/index.php?title=API:Class/Instance/Remove

Secondly, I think the ball going further is due to lag. It works good in solo mode because the server and the client are the same person. Try in game to see if the same lag is happening.

Ad
Log in to vote
1
Answered by
P100D 590 Moderation Voter
8 years ago

Your magic item is probably removing slowly due to client/server lag of the operations before it. Try removing it first, and you should see less lag.

Also: Please use :Destroy() instead of :remove()

Remove is deprecated for good reason.

Answer this question