Hi guys I'm trying to make it so the trail will only show when the player is pressing left shift. This is what I got so far, but it's not working. I'm pressing left shift but the trail is not showing. Any help is appreciated. Thanks!
UserInputService = game:GetService("UserInputService")
if UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) then
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local trail = game.ServerStorage.Trail:Clone()
trail.Parent = char.Head
local attachment0 = Instance.new("Attachment", char.Head)
attachment0.Name = "TrailAttachement0"
local attachment1 = Instance.new("Attachment", char.HumanoidRootPart)
attachment1.Name = "TrailAttachement1"
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
end)
end)
end

1 comment
PlayerAdded and CharacterAdded should both be outside the function, not inside of it.