I’m trying to make a reset function so that if the player dies he or she will keep his inventory
but I can’t seem to script it right. Could you edit my script in a way that might work?
script:
function newCharacter(character)
local player = game.Players:GetPlayerFromCharacter(character)
local trails = player:GetChildren()
for i, trail in pairs(trails) do
if trail.Name == "Trail" then
trail.Parent = player
local trailv = trail.Value
game.ReplicatedStorage.Trail:FireClient(trail.Name)
end
end
local trail = player.PlayerTrail.Value
local speed = player.leaderstats.Speed.Value
local humanoid = character:WaitForChild("Humanoid")
game:GetService("RunService").Stepped:wait()
local storedTrail = game.ReplicatedStorage[trail]
local playerTrail = storedTrail:Clone()
playerTrail.Parent = character.HumanoidRootPart
if character:FindFirstChild("UpperTorso") then
playerTrail.Attachment0 = character.Head.FaceFrontAttachment
playerTrail.Attachment1 = character.UpperTorso.WaistRigAttachment
else
playerTrail.Attachment0 = character.Head.FaceFrontAttachment
playerTrail.Attachment1 = character.HumanoidRootPart.RootRigAttachment
end
humanoid.WalkSpeed = speed
end
i have put a bunch of values but I cant seem to get the remote event to work. Help!