Yeah so i tried but i have no idea how to script a press e and set spawn point thing. I really hope somebody could help me.
COMMUNITY QUESTION
Ummm... Just asking does anyone know how to script e to set spawnpoint?
1 answer
There is no built-in method to set spawn-point. You can however, use a Vector3Value inside the player to determine the most recent spawn-point provided by the client when they pressed e. When the player respawns, move them to their Vector3Value's position. You should have a SpawnLocation somewhere for the "default spawn location" so they do not spawn at (0,0,0).
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
--Create Vector3Value inside player
local v = Instance.new("Vector3Value", Player)
v.Name = "SpawnPoint"
--Check for player respawn
player.CharacterAdded:Connect(function()
--Check for default value, you don't want to spawn them at (0,0,0)
if v.Value ~= Vector3.new(0,0,0) then
workspace:WaitForChild(player.Name):MoveTo(v.Value)
end
end)
end)
From here, you can make a local script and detect when the client presses e. Use a RemoteEvent to tell the server the position of the mouse at the time they hit e. You should start by looking at UserInputService.
This discussion is preserved as it was. New answers, comments, and votes are closed.
