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
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.