Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my trail getting destroyed?

This is my 5th attempt at destroying a trail when the gui button gets clicked. I used alot of different methods but I can't get it to work. Basically when a button is clicked a trail is inserted into the player but I got multiple buttons for different trails. So I want to remove the current trail(s) by clicking on another gui button. FilteringEnabled is on btw, If you could please give me a solution with and without FilteringEnabled.

local plr = game.Players.LocalPlayer

local char = plr.Character

script.Parent.MouseButton1Click:Connect(function()

for i,v in pairs (char:GetChildren()) do

if v:IsA("Trail") then

v:Destroy()

end

end

end)

1 comment

0

Yeah, it's because you're doing it on the client. I would recommend using a RemoteEvent so that the server takes care of making the trail nil.

1 answer

Using a localscript will only show/remove the trail for you, but others will be able to see the trail. This is because guis are client-sided, try using a RemoteEvent to fire a server request so that everyone will be able to see it if you haven't already.

Note that exploiters can use a RemoteEvent to fire the same server request as it's set to.

This discussion is preserved as it was. New answers, comments, and votes are closed.