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

How am I supposed to put a part about 100 studs above a persons head? Here is what I tried.

Asked by 4 years ago
if player:IsInGroup(4324101) then
    local Part = Instance.new("Part", player.Character.Parent)
    player.PlayerGui.Spawn.Enabled = true
    Part.Anchored = true
    Part.Position = Vector3.new(player.Character.Humanoid.Parent.Head)
end

For some reason this wont work. This is in a local script and there is no errors.

0
The part wont go to the character or go to it's head. iiBuilder_Boy 27 — 4y
0
Are you trying to put the part above the player's head by 100 studs or are you trying to put it onto their head? deathmatch7540 7 — 4y
0
Above their head 100 studs. iiBuilder_Boy 27 — 4y

1 answer

Log in to vote
0
Answered by
OnaKat 444 Moderation Voter
4 years ago
Edited 4 years ago
Vector3.new( X , Y , Z )

You put Character.Head so it's a part not vector3 value. You forget .Position

Part.Position = player.Character.Head.Position

But you said that you want to put above 100 studs so you can use Vector3 + Vector3

Part.Position = player.Character.Head.Position + Vector3.new(0,100,0)

If you want to set CFrame use CFrame * CFrame

Part.CFrame = player.Character.Head.CFrame * CFrame.new(0,100,0)

note:

local X = 0 -- X>0 == right     |   0>X == left 
local Y = 0 -- Y>0 == up        |   0>Y == down
local Z = 0 -- Z>0 == backward  |   0>Z == forward
Part.CFrame = player.Character.Head.CFrame * CFrame.new(X,Y,Z)
Ad

Answer this question