Need help on a flash game!

Hello i am Blood007lol and i need help on a trail
Im making a flash game and i want the trail on the hand, feet and in the head but idk how to do it
also i want the trail is active when we run plus 50 walk speed
maybe its the script
The script:

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local trail = game.ServerStorage.TrailInner:Clone() and game.ServerStorage.TrailOuter: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)
end)

2 Likes

Simply change the attachment parents, also edited some of your code.
This isn’t the best method though.

local function addTrail(trail, char, parent)
local head = char:WaitForChild("Head")
local attachment0

if not head:FindFirstChild("Attachment") then
Instance.new("Attachment", head)
end

attachment0 = head.Attachment
local attachment1 = Instance.new("Attachment", parent)

trail.Attachment0 = attachment0
trail.Attachment1 = attachment1

trail.Parent = head
end

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local trail = game.ServerStorage.TrailOuter

local limbs = {
char:WaitForChild("LeftLowerArm"),
char:WaitForChild("RightLowerArm"),

char:WaitForChild("LeftLowerLeg"),
char:WaitForChild("RightLowerLeg")
}

for _, limb in pairs(limbs) do
addTrail(trail:Clone(), char, limb)
end
end)
end)

For the walkspeed go to game settings in studio, click World then set the WalkSpeed to 50.

2 Likes

actually the trail is not working

Seems to work fine for me, do you have any errors in your output?

make sure its r15 i think