How can i make people who play the game respawn with a key?
Example: Someone is playing, and then he wanted to respawn. How can i make this player respawn when he presses the R key?
I explained it the best I could, put this script in StarterGui or StarterPack.
-- Variables local player = game.Players.LocalPlayer -- Now you can refer to the player local mouse = player:GetMouse() -- Now you can refer to the mouse -- Main script mouse.KeyDown:connect(function(Key) -- When they press a key local key = string.lower(Key) -- So if they use caps, there might be a easier way if key == "r" then -- If the lower key is r player:LoadCharacter() -- Respawn them end -- End the if function end) -- End the function
Create a local script that calls a function anytime the player presses down the key you assign. Then you can have him respawn a number of ways, whether by killing the current character or by setting a fixed "Spawn location" to go to.
Info on LocalScripts: http://wiki.roblox.com/index.php?title=API:Class/LocalScript
Info on Keyboard input: http://wiki.roblox.com/index.php?title=Keyboard_input