Like you character dies and you have to press space or r to respawn.also can it work for a button to?
you can use a variation of the below code, detects a keyboard input and reacts to the input: (UserInputService)
local UserInputService = game:GetService('UserInputService') function onInputBegan(input,gameProcessed) if input.KeyCode == Enum.KeyCode.Up then -- Up arrow end end UserInputService.InputBegan:connect(onInputBegan)
other keys (including r) can be found here
Use a local script Insert a Vector3 Value inside of the script
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() repeat wait() until Player.Character Character = Player.Character Character.Humanoid.Died:connect(function(died) Character.Torso.Position = script.Value.Value Mouse.KeyDown:connect(function(key) if key == "r" then player:LoadCharacter() end end) end)
Try this