#how to make the clones appear with no delay and all the players on server could see them

1 messages · Page 1 of 1 (latest)

vivid rivet
#

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)
lament radish
#

you can try sending a remote to the client for the duration you want them to appear because i dont think you really can remove the delay because of ping

#

just have the client run a for loop

vivid rivet
#

wym to the client

#

others wont see the clones

lament radish
#

you could send it to all clients then and tell them what character is making clones

pure haven
#

you would have to do event:FireAllClients()

vivid rivet
#

but can i do it only on client side with bindable event??

lament radish
vivid rivet
pure haven
#

assuming the script above is server sided you would only need two

vivid rivet
#
    if ClonedCharacter then
        ClonedCharacter.Archivable = true
        local humanoidRootPart = ClonedCharacter:FindFirstChild("HumanoidRootPart")
        if humanoidRootPart then
            local clone = ClonedCharacter: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)
        end
    end
end

ClientEvent.OnClientEvent:Connect(function(sender)
    if sender ~= player then
        local char = sender.char
        CloneCharacter(char)
    end
end)

uis.InputBegan:Connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.E and processed == false then
        ServerEvent:FireServer()
        local timepassed = tick()

        while tick() - timepassed < 5 and humanoid.Health > 0 do
            task.spawn(CloneCharacter(character))
            task.wait(.1)
        end
    end
end)```
#

this is local

#
local rs = game.ReplicatedStorage

local ServerEvent = rs.SandevistanFolder:WaitForChild("SandevistanServerRemote")
local ClientEvent = rs.SandevistanFolder:WaitForChild("SandevistanClientRemote")

local ClonesFolder = game.Workspace:WaitForChild("ClonesFolder")
local Debris = game:GetService("Debris")


ServerEvent.OnServerEvent:Connect(function(player)
    ClientEvent:FireAllClients(player)
end)
#

and thats server

#

but rn it doenst show the clones to other players...

pure haven
vivid rivet
#

the bottom script is the server script