local background = workspace.BloomBackground
local players = game:GetService("Players")
local clonedBackgrounds = {}
game:GetService("ReplicatedStorage").AmberS1.OnServerEvent:Connect(function(player)
if player.Character then
local tool = player.Character:FindFirstChild("Magic Finix Amber")
if tool then
local character = player.Character
local humanoid = character.Humanoid
local clonedBackground = background:Clone()
clonedBackground.Parent = workspace
clonedBackgrounds[player] = clonedBackground
humanoid.Died:Once(function() -- Add things you want to destroy when player dies/resets in here
clonedBackgrounds[player]:Destroy()
end)
clonedBackgrounds[player]:Destroy()
humanoid.WalkSpeed = 16
humanoid.JumpHeight = 7.2
character.PrimaryPart.Anchored = false
tool:Destroy()
else
warn("Magic Finix Amber isn't equipped!")
end
else
warn("player.Character is currently nil")
end
end)
game.ReplicatedStorage.ChangePlayerCharacter.OnServerEvent:Connect(function(player)
clonedBackgrounds[player]:Destroy()
end)
players.PlayerRemoving:Connect(function(player)
clonedBackgrounds[player]:Destroy()
end)