Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

help me im making a game but there is a bug which i dont know how to fix it?(its server script)

Asked by 1 year ago

im making a game where you get a pet same avatar as you but when other player joins he doesnt get pet and the 1st players pet gets changed to the 2nd players avatar

Code:

game.Players.PlayerAdded:Connect(function(plr)
    local char = game.ServerStorage:WaitForChild("Pet")
    local charclone = char:Clone()
    charclone.Name = plr.Name.." Pet"
    charclone.HumanoidRootPart.Position = Vector3.new(plr.Character)
    charclone.Parent = workspace

    local humanoid = charclone.Humanoid
    local playerId = (plr.UserId)
    humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(playerId))
    while wait(0.1) do
        charclone.Humanoid:MoveTo((game.Workspace:WaitForChild(plr.Name).HumanoidRootPart.CFrame*CFrame.new(0,0,3)).p)
    end
end)


0
Any errors coming from it in the output? Jay123abc2 241 — 1y
0
nope JustGodex 10 — 1y

Answer this question