I have a local script in the StarterPlayerScripts folder that checks if the player is moving. If the player is moving, then it clones a part from ReplicatedStorage and places it in the workspace right behind the player. This creates a nice trail behind the player as they walk/run (like the cycles in TRON)
The part that is replicated has an attached script that will make it fade away over time. I have tested this by placing the part in the workspace directly and it works perfectly. However the same part and script does not work if its is cloned. It appears in the workspace as expected but the script attached to it does nothing. I have checked the part AND script are being cloned.
Thanks for any guidance,
rich
Script on the part:
local Trail = script.Parent
for thisTrans = 0,1,.01 do
Trail.Transparency=thisTrans
wait(.1)
end
local script on the play:
local RunService = game:GetService(“RunService”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local trail= ReplicatedStorage.Trail
local Players = game:GetService(“Players”)
local localPlayer = Players.LocalPlayer
local function updateTrailEffect()
if localPlayer.Character then
local humanoid = localPlayer.Character:FindFirstChild(“Humanoid”)
if humanoid then
humanoid.WalkSpeed=25
if humanoid.MoveDirection.Magnitude > 0 then
local humanoidRootPart = localPlayer.Character:WaitForChild(“HumanoidRootPart”)
local ThisTrail=trail:Clone()
ThisTrail.Parent = game.Workspace.PlayerTrails
local offsetCFrame = CFrame.new(0, 0, 3)
ThisTrail.CFrame = humanoidRootPart.CFrame:ToWorldSpace(offsetCFrame)
end
end
end
wait()
return true
end
while updateTrailEffect() do
wait()
end
Screenshot of my setup: