im struggling with an issue that is annoying me this server script is a clone script that has a delay and dont spawn the clones right in the players body is there any way to bypass it
local event = rs.SandevistanFolder:WaitForChild("SandevistanRemote")
local ClonesFolder = game.Workspace:WaitForChild("ClonesFolder")
local Debris = game:GetService("Debris")
event.OnServerEvent:Connect(function(player)
local timepassed = tick()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid")
local function CloneCharacter()
if character then
character.Archivable = true
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
local clone = character:Clone()
for _, cloneChild in pairs(clone:GetChildren()) do
if cloneChild:IsA("BasePart") then
cloneChild.Anchored = true
cloneChild.CanCollide = false
cloneChild.CollisionGroup = "Clone"
end
end
clone.HumanoidRootPart.CFrame = humanoidRootPart.CFrame
clone.Parent = ClonesFolder
clone.Name = "Clone"
clone.Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
clone.Humanoid.HealthDisplayType = Enum.HumanoidHealthDisplayType.AlwaysOff
Debris:AddItem(clone,.7)
end
end
end
-- генерация клонов 5 секунд
while tick() - timepassed < 5 and humanoid.Health > 0 do
task.spawn(CloneCharacter)
task.wait(.1)
end
end)