In my game I have a footstep system with a server script script and a client script for the footstep system the client looks like this
--#Services local tweenService = game:GetService("TweenService") local debris = game:GetService("Debris") local players = game:GetService("Players") local runService = game:GetService("RunService") local replicatedStorage = game:GetService("ReplicatedStorage") --#Objects local folder = workspace.FootprintFolder local mainFolder = replicatedStorage.Footsteps local remoteEvent = mainFolder.FootstepsEvent local configuration = mainFolder.FootstepsConfig --#Constants local fadeTime = configuration.FadeTime.Value local frequency = configuration.Frequency.Value local viewOtherPrints = configuration.ViewOtherPrints local useFloorColor = configuration.UseFloorColor local useFootSize = configuration.UseFootSize local particlesOnMaterial = configuration.ParticlesOnMaterial local notMoving = Vector3.new(0, 0, 0) local defaultParticleFade = 0.1 --#Functions local RayCast = function(origin,target,ignorelist) local params = RaycastParams.new() params.FilterType = Enum.RaycastFilterType.Exclude params.FilterDescendantsInstances = (ignorelist) local raycast = workspace:Raycast(origin,target,params) if raycast then return raycast else return nil end end local createFootPrint = function(leg, hitnormal, hitPosition,hit,hitmaterial) local footprint = script.Footprint:Clone() footprint.Parent = folder footprint.CFrame = CFrame.new(hitPosition, footprint.Position+hitnormal) footprint.Orientation = leg.Parent.HumanoidRootPart.Orientation if useFootSize.Value == true then footprint.Size = Vector3.new(leg.Size.X, 0.1, leg.Size.Z) end if useFloorColor.Value == true then if tostring(hit.Name) == "Terrain" then footprint.Color = workspace.Terrain:GetMaterialColor(hitmaterial) else footprint.BrickColor = hit.BrickColor end end if particlesOnMaterial.Value == true then local player = game.Players.LocalPlayer local findParticle = particlesOnMaterial:FindFirstChild(hitmaterial) if findParticle then local particle = findParticle:Clone() particle.Parent = footprint local waittime = particle:FindFirstChild("HowLongToLast").Value or 0.5 coroutine.wrap(function() particle.Enabled = true task.wait(waittime) particle.Enabled = false task.wait(particle.Lifetime.Max) particle:Destroy() end)() end end return footprint end local tween = function(t, instance, properties, style, direction, waitUntilDone) local info = TweenInfo.new(t, Enum.EasingStyle[style], Enum.EasingDirection[direction]) local tween = tweenService:Create(instance,info,properties) tween:Play() if waitUntilDone == true then tween.Completed:Wait() end end --#Event replicatedStorage.Footsteps.FootstepsEvent.OnClientEvent:Connect(function(char) repeat task.wait() until char local startFootprints = true local humanoid = char:FindFirstChild("Humanoid") or char:WaitForChild("Humanoid", 5) while startFootprints == true do task.wait() if humanoid.MoveDirection ~= notMoving then local leftLeg = char:FindFirstChild("Left Leg") or char.LeftFoot local rightLeg = char:FindFirstChild("Right Leg") or char.RightFoot local raycastr = RayCast(rightLeg.Position, leftLeg.CFrame.UpVector * -3, {char, folder}) if raycastr then local hit, hitnormal, hitposition, hitmaterial = raycastr.Instance, raycastr.Normal, raycastr.Position, raycastr.Material if hit.Parent ~= folder then local rightprint = createFootPrint(rightLeg,hitnormal,hitposition,hit,hitmaterial) tween(fadeTime, rightprint, {Transparency = 1}, "Linear", "Out", false) debris:AddItem(rightprint,fadeTime*2) end end task.wait(frequency) local raycastl = RayCast(leftLeg.Position, leftLeg.CFrame.UpVector * -3, {char, folder}) if raycastl then local hit, hitnormal, hitposition, hitmaterial = raycastl.Instance, raycastl.Normal, raycastl.Position, raycastl.Material if hit.Parent ~= folder then local leftprint = createFootPrint(leftLeg,hitnormal,hitposition,hit,hitmaterial) tween(fadeTime, leftprint, {Transparency = 1}, "Linear", "Out", false) debris:AddItem(leftprint, fadeTime*2) end end task.wait(frequency) end end end)
and the server looks like this
–#Services
local players = game:GetService(“Players”)
local serverScriptService = game:GetService(“ServerScriptService”)
local replicatedStorage = game:GetService(“ReplicatedStorage”)
–#Instances
local remote = Instance.new(“RemoteEvent”)
local folder = Instance.new(“Folder”)
local walkingremote = Instance.new(“RemoteEvent”)
–#Setup
script.Parent = serverScriptService
folder.Parent = replicatedStorage
remote.Parent = folder
folder.Name = “Footsteps”
remote.Name = “FootstepsEvent”
walkingremote.Parent = folder
walkingremote.Name = “WalkingRemote”
script.FootstepsConfig.Parent = folder
local workspacefolder = Instance.new(“Folder”,workspace)
workspacefolder.Name = “FootprintFolder”
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
repeat wait() until char and folder.FootstepsConfig
local viewOthersPrints = folder.FootstepsConfig.ViewOtherPrints
if viewOthersPrints.Value == true then
remote:FireAllClients(char)
else
remote:FireClient(plr,char)
end
end)
end)
walkingremote.OnServerEvent:Connect(function(plr,movement)
local char = plr.Character
char.Humanoid:Move(movement)
end)
there is a footprint part inside the client
my problem is when I die the footsteps I had remain heres what that looks like
I would love some help with this issue!