Hi. So i have a GUI that when you click on one, it is going to enable the trail in the character and another that it disables when you click on it. It wont work for some weird reason and im not sure why.

This script puts the trail inside the character if you have the game pass:

id = 1524608874
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
        player.CharacterAdded:connect(function(char)
		local trail = game.ServerStorage.Trail:Clone()
		trail.Parent = char.Head
		trail.Name = "CharTrail"
		trail.Enabled = false
		player.PlayerGui.TrailGUI["GUI Open/Close"].Visible = true
		player.PlayerGui["Visible Trail GUI"]["Trail Enable"].Visible = true
		player.PlayerGui["Visible Trail GUI"]["Trail Disable"].Visible = true
		local attachment0 = Instance.new("Attachment", char.Head)
		attachment0.Name = "TrailAttachment0"
		local attachment1 = Instance.new("Attachment", char.HumanoidRootPart)
		attachment1.Name = "TrailAttachment1"
		trail.Attachment0 = attachment0
		trail.Attachment1 = attachment1
end)
else
	player.CharacterAdded:connect(function(char)
		local trail = game.ServerStorage.Trail:Clone()
		trail.Parent = char.Head
		trail.Name = "CharTrail"
		trail.Enabled = false
		player.PlayerGui.TrailGUI["GUI Open/Close"].Visible = false
		player.PlayerGui["Visible Trail GUI"]["Trail Enable"].Visible = false
		player.PlayerGui["Visible Trail GUI"]["Trail Disable"].Visible = false
	end)
end
end)
		

This one controls the gui to enable and disable the trail:

allowbutton = script.Parent["Trail Enable"]
disallowbutton = script.Parent["Trail Disable"]


allowbutton.MouseButton1Down:connect(function()
		game.Players.PlayerAdded:connect(function(player)
			player.CharacterAdded:connect(function(char)
				wait(1)
				local trail = char.Head.CharTrail
				trail.Enabled = true
			end)
	end)
		end)


disallowbutton.MouseButton1Down:connect(function()
	game.Players.PlayerAdded:connect(function(player)
		player.CharacterAdded:connect(function(char)
			wait(1)
			local trail  = char.Head.CharTrail
			trail.Enabled = false
		end)
	end)
end)

If anyone can help or if you need more info, let me know! Thank you!

3 comments

0

Have you tried to destroy the trail than use Instance.New("Trail") to create a new one?

0

I tried it that but it still didn't work for some reason.

0

I'm pretty sure clients can't handle trails and other stuff like that, even if it is not filtering enabled.