mouse = game.Players.LocalPlayer:GetMouse()
local player = game.Players.LocalPlayer
repeat wait() until player.Character

mouse.KeyDown:connect(function(key)
if tostring(key) == "r" then
player:LoadCharacter()
end
end)


4 comments

0

Edited for code block.

0

LoadCharacter doesn't work in localscripts, if you want a player to respawn after they jump, right after they die, you don't use keydown, you use .Died:Connect(function() and you use LoadCharacter() from server, which means you have to recode everything for it to be server-sided, enjoy my brief explanation, I hope this comment helped.

0

im very new to coding, sorry