R to kill player

how would i do R to kill the myself? Please and thankyou

1 Like

https://developer.roblox.com/en-us/api-reference/class/UserInputService
https://developer.roblox.com/en-us/api-reference/property/Humanoid/Health

Use UserInputService.InputBegan to detect if the player has clicked a key and TakeDamage function or the Health property to change the health.

repeat wait() until game:IsLoaded()
local plr = game.Players.LocalPlayer
local char = plr.Character
local uis = game:FindService("UserInputService") or game:GetService("UserInputService")

uis.InputBegan:Connect(function(key, gpe)
	if gpe then return end
	if key.KeyCode == Enum.KeyCode.R then
		char.Humanoid.Health = 0
	end
end)

Put this in a local script inside starter pack enjoy

i suggest you add this

uis.InputBegan:Connect(function(Key, Chatted)
	if Chatted then
		return
	end

i always do it when I am doing stuff with keys

Thats what gpe is lmao, dont correct me c;

1 Like