This script is a local script inside starterpack, I think the problem is I need to get the character in workspace, but I don't know how to do that.
I would like this to make the part appear over anyone no matter the name, that's why I did LocalPlayer
When I press E, this error comes up Head is not a valid member of Player
part = Instance.new("Part",game.Workspace) local players = game.Players.LocalPlayer local mouse = players:GetMouse() mouse.KeyDown:connect(function(key) if key == "e" then part.CFrame = CFrame.new(players.Head.Position) + Vector3.new(0,5,0) part.Anchored = true local new = Instance.new("Part",game.Workspace) new.CFrame = CFrame.new(players.Head.Position) + Vector3.new(0,5,0) new.Anchored = true end end)
The output is correct -- Head isn't a valid member of player; it's under Character, instead.
This should work, I think:
part = Instance.new("Part",game.Workspace) local players = game.Players.LocalPlayer local Character = players.Character local mouse = players:GetMouse() mouse.KeyDown:connect(function(key) if key == "e" then part.CFrame = CFrame.new(players.Character.Head.Position) + Vector3.new(0,5,0) part.Anchored = true local new = Instance.new("Part",game.Workspace) new.CFrame = CFrame.new(players.Character.Head.Position) + Vector3.new(0,5,0) new.Anchored = true end end)