I am making a system where when a player clicks a part, a trail gets attached to them.
I have a part in the workspace named "Part" In the part there is a clickdetector named "ClickDetector" In the workspace there is a remote event named "MyClickDetector" In the remote event there is a script named "Script" In the starter gui there is a localscript named "LocalScript" there is a trail in the ServerStorage
This is the LocalScript
local clickdetector = game.Workspace.Part.ClickDetector
clickdetector.MouseClick:Connect(function()
game.Workspace.MyClickDetector:FireServer()
end)
This is the script in the remote event
game.Workspace.MyClickDetector.OnServerEvent:Connect(function()
--not sure how to make it attach on the player that has clicked the part
local trail = game.ServerStorage.Trail:Clone()
trail.Parent = char.Head
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)
