The Footsteps Stay When I Die

what? sorry i dont understand. what do you mean?

if you load the fingerprints from the client the server will not be able to delete them, what you should do is delete them in the client, it should be noted that as you apparently did not load the fingerprints on the server because the other clients will not see them, so if you delete them in the client there is no problem.

well yes but my problem is it wont delete in the client

I’m a moron with English… on the server what you should do is to send the event to all the other clients and then from a local script detect the event and delete the traces.

so u want me to swap what i did with the local script to the serverscript?

heres what it looks on the server
image
and heres the client
image

this: step1: in the local function of clearOnDeath send a remote event to the server, then the server detects it and spawns a function that waits for the event Humanoid.Died then when it detects it sends a remote event to all the local players and the name of the player that died, the client detects the event, verifies that the player that died is the same as the one that detects the event and then deletes his steps, easy

well, could you do this? i dont really understand.

tell @happya_x he makes free codes

I didn’t realize the footprints were on the server
Make a folder for footprints and then we will make a folder in that folder for each player. The player’s folder will contain all of their own footprints. This way, we don’t have to use any complicated communication between the client and server and we can do everything from one script.

I also included a function called getPlrFolder so you can use this to put the footprints of the player in their personal folder.

local folder = game.Workspace.footPrints -- folder to contain everything

game.Players.PlayerAdded:Connect(function(plr) -- fires when a player joins
	
	local plrFolder = Instance.new("Folder", folder) -- create a personal folder for that player
	plrFolder.Name = plr.Name -- name that folder to the players name so its easier in the future
	
	plr.CharacterAdded:Connect(function(char) -- fires when their character loads
		local humanoid = char:WaitForChild("Humanoid") -- waits for their humanoid
		humanoid.Died:Wait() -- waits until the humanoid dies
		plrFolder:ClearAllChildren() -- clear everything in the player's folder
	end)
end)

function getPlrFolder(name) -- function to get a player's folder given their name
	return folder:FindFirstChild(name) -- searches for a folder of the player's name. this works because we set it the folder to the player's name before. 
end

they are still there even with this, they are not on the server but on the client side they are still there.

i looked at the folders and they are actually not even filling up with the footprints.

i included the getPlrFolder function so you could script the footprints appearing in the player’s folders

friend simply deletes the fingerprints from the client

tell me what part you don’t understand I don’t plan to make code just like that without you telling me what part you need.

the part where it finds out which player is which

ok so i made it so the footprints go inside the player folder, but the footprints still occur on the client.

ok it works now but after the player dies the footpritns dont come back
heres the scripts i used

local:

local folder = game.Workspace.FootprintFolder – folder to contain everything

local plr = game.Players.LocalPlayer

local plrname = plr.Name

local char = plr.Character or plr.CharacterAdded:Wait()

local remote = game.ReplicatedStorage.death

local plrFolder = workspace.FootprintFolder:WaitForChild(plrname)

remote.OnClientEvent:Connect(function()

local humanoid = char:WaitForChild(“Humanoid”) – waits for their humanoid

humanoid.Died:Wait() – waits until the humanoid dies

plrFolder:ClearAllChildren() – clear everything in the player’s folder

end)

server:

local folder = game.Workspace.FootprintFolder – folder to contain everything
local remote = game.ReplicatedStorage.death

game.Players.PlayerAdded:Connect(function(plr) – fires when a player joins

local plrFolder = Instance.new(“Folder”, folder) – create a personal folder for that player
plrFolder.Name = plr.Name – name that folder to the players name so its easier in the future

plr.CharacterAdded:Connect(function(char) – fires when their character loads
local humanoid = char:WaitForChild(“Humanoid”) – waits for their humanoid
humanoid.Died:Wait() – waits until the humanoid dies
plrFolder:ClearAllChildren() – clear everything in the player’s folder
remote:FireClient(plr)
end)
end)

function getPlrFolder(name) – function to get a player’s folder given their name
return folder:FindFirstChild(name) – searches for a folder of the player’s name. this works because we set it the folder to the player’s name before.
end

main local:

–#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”)
local player = game.Players.LocalPlayer
local playername = player.Name
–#Objects
local folder = workspace.FootprintFolder:WaitForChild(playername)
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)

main server:

local players = game:GetService(“Players”)
local serverScriptService = game:GetService(“ServerScriptService”)
local replicatedStorage = game:GetService(“ReplicatedStorage”)

–#Instances
local remote = Instance.new(“RemoteEvent”)
local folder = replicatedStorage.Footsteps
local walkingremote = Instance.new(“RemoteEvent”)

–#Setup
script.Parent = serverScriptService
remote.Parent = folder
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

  char.Humanoid.Died:Connect(function()
  	for _, footprint in ipairs(workspacefolder:GetChildren()) do
  		footprint:Destroy()
  	end
  end)

end)
end)

walkingremote.OnServerEvent:Connect(function(plr, movement)
local char = plr.Character
char.Humanoid:Move(movement)
end)

in every local script you must have a Plr variable, then when the server detects that a player died it sends the remote event to all the players with a parameter (the player that died) then the client detects the event and verifies if the player that died is the client, if it is the client then it eliminates the client steps.

lol i fixed it for him guys, im a scripter for him and just redid it all

(funkymonkey is silly guy who make more scripts for 1 thing then he has to)

Answer for anyone having the problem:
The system I used was a single server script inside StarterCharacterScripts, here’s a flowchart of how it worked so I don’t torture you with my poor communication skills:

This is how it’d work in a while loop.
I used RunService, so it’s slightly different.
The difference is, if the raycast result doesn’t exist, it just hits a dead end, and runservice will loop back for you without actually making you wait the X amount of seconds at the beginning of the loop.

1 Like