Hi, I'm new to scripting and I want to make it so when you press F, a model appears behind the player. Can someone please help?
Hi, to accomplish this, you will need to get use to using the UserInputService
since keyDown
is deprecated. Here's an example
local UIS = game:GetService("UserInputService") local p = game.Players.LocalPlayer debounce = false UIS.InputBegan:Connect(function(Input, gameProcessedEvent) local KeyCode = Input.KeyCode -- creates a value called KeyCode for future use if not gameProcessedEvent then -- checks if the player ISN'T TYPING if KeyCode == Enum.KeyCode.F and debounce == false then debounce = true -- prevents it from being ran over and over again local newPart = Instance.new("Part", workspace) -- change `workspace` to where you want the part to be parented to newPart.Name == "IMadeANewPart!" -- change that to your part's name --Also use the properties to set how the part will look. For ex: newPart.Size = Vector3.new(0, 0, 0) -- change 0, 0, 0 depending on the X, Y, & Z Sizing newPart.CanCollide = false -- determines if the block is walkthrough newPart.Transparency = 0 -- change that to how transparent you want the block to be newPart.Shpae == "" -- use the properties tab on the brick to set the shape newPart.CFrame = p.Character.Torso.CFrame * CFrame.new(0, 0, 0) -- once again change 0, 0, 0 depending on the X, Y, & Z's Position this time. Since you want it behind, i would suggest changing the X or the Z's coordinates, i forgot which one goes back and fourth. Also change `Torso` to either `UpperTorso` or `LowerTorso` depending on if the character is R15 end end end)
--Also if you want the script to be ran again, put debounce = true if at the end if you want the script to be ran again
Any more questions, please feel free to ask!
--oSy