#player clones are spawning a few cm after the character but they need to spawn right in him

1 messages · Page 1 of 1 (latest)

ripe sequoia
#

so i made a clone script when on the server side and i need for clones to spawn right in the players body, also i have a directional movement script that also doesn`t work on the clones

local rs = game.ReplicatedStorage
local event = rs.SandevistanFolder:WaitForChild("SandevistanRemote")
local ClonesFolder = game.Workspace:WaitForChild("ClonesFolder")

event.OnServerEvent:Connect(function(player)
table.insert(PlayersOnCD, player.Name)

local timepassed = tick()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid")

local function CloneDestroy(clone)
    task.wait(0.7)
    clone:Destroy()
end

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

            CloneDestroy(clone)
        end
    end
end

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

end)

keen moss
#

I don't think it's possible to make the clone character spawn right on top, It's truly possible on client side but server side I think isn't possible

#

And also is the directional movement a server side or client side? And is the script local script or just a normal script?

ripe sequoia
#

its a local

#

do i need to change it to server?

keen moss
#

Oh well then I don't know what went wrong honestly

keen moss
ripe sequoia
#

so how to make the clones have the direction of the plr

keen moss
#

Oh wait I think I know why, so this script right here I think is on normal script because of the event.OnServerEvent:Connect() but if you want it to be right on top then you have to clone it on the client side and not server side

ripe sequoia
#

yea but i want the players to see the clones too

keen moss
#

You can use bindable event and then fire it to all clients

void pineBOT
#

studio** You are now Level 1! **studio

ripe sequoia
#

ok i`ll try

keen moss
#

Alright, I hope it'll work

#

Also I just realised you used a whole function just to destroy the clone, I think it's better to just use Debris instead no?

ripe sequoia
#

wym

keen moss
#

Isn't it better that instead of using

local function CloneDestroy(clone)
task.wait(0.7)
clone:Destroy()
end

You use

local debris = game:GetService("Debris:)
debris:AddItem(clone, 0.7)

ripe sequoia
#

щр

#

oh

#

forgot i could do that

#

thanks