✓ Accepted answer
#You're close.
The IsKeyDown method of UserInputService will return true if you are pressing the key with the key code you pass. The check is only made once, the script won't check again. Using the InputBegan event you can do the check there.
local client = game:GetService("Players").LocalPlayer
game:GetService("UserInputService").InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.V then
client.Character:SetPrimaryPartCFrame(CFrame.new(234,4.31,446.92))
end
end)
Finally, indexing the character from the workspace is not a good idea. If a user named Terrain or Part joined your game your script would break, lol
######Hopefully this answered your question, and if it did, then don't forget to hit that accept button. If you have any other questions then feel free to leave them down in the comments.
1 comment
Ok this is good information to know, I really appreciate this. I was doing it the choppy way, never even thought about the username thing. Thanks!!