Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

2 comments

0

thanks bro

0

Glad to help.

This discussion is preserved as it was. New answers, comments, and votes are closed.