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

How to Spawn block on player head?

Asked by 4 years ago
local plr = game.Players.LocalPlayer
block = Instance.new("Part")
block.CFrame = CFrame.new(plr.Character.Head.Position)
--yes
0
fix plz TestGloryRare 7 — 4y
0
What do you mean by spawn block? CRAZYQUACKY84 113 — 4y
0
Spawn a part TestGloryRare 7 — 4y
0
On a players head? CRAZYQUACKY84 113 — 4y
0
your nearly there, just add on line 3 + Vector3(0, 3, 0) -- Change y position CRAZYQUACKY84 113 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

You were pretty close, but block.CFrame = CFrame.new(plr.Character.Head.Position) doesn't work because those are two incompatible values. Instead all you have to do is take the X, Y, and Z values of the head and use those instead.

Also, when spawning something using Instance.new don't forget to set its Parent!

local plr = game.Players.LocalPlayer
block = Instance.new("Part")
block.Parent = game.Workspace
block.CFrame = CFrame.new(plr.Character.Head.Position.X, plr.Character.Head.Position.Y, plr.Character.Head.Position.Z)
Ad

Answer this question