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

Any help on trying to spawn a part on someones head?

Asked by 5 years ago

so when you click this gui it should spawn this Part/Ball on a players head

game.ReplicatedStorage.CloneBall.OnServerEvent:Connect(function(player)
    if game:FindFirstChild("ServerStorage") and game.ServerStorage:FindFirstChild("Ball") and player and player.Character:FindFirstChild("Head") then
        local cloneball = game.ServerStorage.Ball:Clone()
        cloneball.Parent = cloneball.CFrame == CFrame.new(player.Character.Head.Position)
    end
end)

tried this but it didnt work

1 answer

Log in to vote
1
Answered by 5 years ago

Hi WillBe,

In your script, the 4th line doesn't make any sense. You're setting the parent equal to a boolean value. This doesn't make sense. Set the parent to the workspace and then set the CFrame on another line. Also, the CFrame should be set to the head's CFrame multiplied by a negative y value, depending on how high you want the ball above the player's head. It should look like this:

game.ReplicatedStorage.CloneBall.OnServerEvent:Connect(function(player)
    if game:FindFirstChild("ServerStorage") and game.ServerStorage:FindFirstChild("Ball") and player and player.Character:FindFirstChild("Head") then
        local cloneball = game.ServerStorage.Ball:Clone()
        cloneball.Parent = workspace;
    cloneball.CFrame = player.Character:WaitForChild("Head").CFrame * CFrame.new(0, -5, 0);
    end
end)

I hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

0
thanks bro WillBe_Stoped 71 — 5y
0
Glad to help. KingLoneCat 2642 — 5y
Ad

Answer this question