Answered by
4 years ago Edited 4 years ago
first you didnt get the character's position
second the vector3.new is wrong(assuming your trying to spawn the part on top of your character on line 18)
vector only takes number values and doesnt take something like game.Players.LocalPlayer
third line 12 is not needed you will make your code run an extra step that doesnt do anything
the code will run without UserInputType
fourth on line 17 part.Size has to be vector3 like this
1 | part.Size = vector 3. new( 5 , 5 , 5 ) |
or you will get an error
on line 16 instead of doing (this wont cause an error but if you give properties before parenting part to workspace you get better performance and idk if this is true but i heard it some where when i just started out coding)(of course you can do it both ways)
do
2 | part.Properties = awh 8 d 7 ga 7 wudbaw 87 duyhawj |
now for the part's position
1 | vector 3. new(Right Or Left, Up Or Down, Front And Back) |
surprisingly even tho you didnt put in number values in the vector correctly the code actually runs when i tested it (line 18)
now heres the solution for everything
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local player = game:GetService( "Players" ).LocalPlayer or game.Players.LocalPlayer |
05 | UIS.InputBegan:Connect( function (input, gameProcessedEvent) |
06 | if input.KeyCode = = Enum.KeyCode.Q then |
07 | local part = Instance.new( "Part" , workspace) |
08 | part.Size = Vector 3. new( 5 , 5 , 5 ) |
09 | part.CFrame = player.Character.Head.CFrame * CFrame.new( 0 ,abovePlayer, 0 ) |
this is my first answer post so im sorry if its really bad