I've been trying to do this for a while now but hasn't worked out that well... I'm using this code currently:
local player = game.Players.LocalPlayer.Character local redtrail = game.Workspace.RedTrailButton.ClickDetector redtrail.MouseClick:connect(function() local trail = game.ServerStorage.RedTrail:Clone() trail.Parent.Parent = game.Workspace.player.Head local attachment0 = Instance.new("Attachment", player.Head) attachment0.Name = "TrailAttachment0" local attachment1 = Instance.new("Attachment", player.HumanoidRootPart) attachment1.Name = "TrailAttachment1" trail.Attachment0 = attachment0 trail.Attachment1 = attachment1 end)
This is a LocalScript, because if it was a normal script it would return as a nil value which is annoying.
But when I click the brick it never gives me the trail, it also gives me no errors in the console when clicked. Any help on how to make it give me a trail?
Also, everything is in the right place. The "player" bit refers to your character so that it can add it to the Torso area.
This should be a regular script as you can't access ServerStorage from the client, hence ServerStorage.
local redtrail = game.Workspace.RedTrailButton.ClickDetector redtrail.MouseClick:connect(function(player) -- use the mouseclick's player argument local trail = game.ServerStorage.RedTrail:Clone() trail.Parent = player.Character.Head local attachment0 = Instance.new("Attachment", player.Head) attachment0.Name = "TrailAttachment0" local attachment1 = Instance.new("Attachment", player.HumanoidRootPart) attachment1.Name = "TrailAttachment1" trail.Attachment0 = attachment0 trail.Attachment1 = attachment1 end)