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

Why won't the ball spawn at the players position?

Asked by 6 years ago
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
    local original = workspace.Ball
    local copy = original:Clone()
    local character = player.Character or player.CharacterAdded:wait()
    local CF = character:WaitForChild("HumanoidRootPart").Position
    copy.Parent = original.Parent
    copy.CFrame = CFrame.new(CF)
end)
0
:wait() is deprecated. Use :Wait() instead. Why don't you set the parent of the copy to "workspace" on line eight? User#25115 0 — 6y
0
Add a wait(1) before line 07. Your characters position will be in the air somewhere in the middle of the baseplate. Thetacah 712 — 6y

1 answer

Log in to vote
0
Answered by
karbis 50
5 years ago
Edited 5 years ago

you got the position of the humanoid root part cframes use cframes not positions you would have to do copy.Position = CF but heres the fixed script

math.randomseed(tick()) -- can remove but added just incase
local Players = game:GetService("Players")   
Players.PlayerAdded:Connect(function(player)
        local original = workspace.Ball
        local copy = original:Clone()
        local character = player.Character or player.CharacterAdded:Wait()
        local CF = character:WaitForChild("HumanoidRootPart").Position
        copy.Parent = original.Parent
        copy.Position = CF -- (or Vector3.new(CF))
end)

Ad

Answer this question