how would i do this in a script like a function in starter pack? (I found resetting make my game not lag for some reason so I make the player respawn every time they push the button)
I assume that when you press a certain button, it will respawn you. have you tried using player:LoadCharacter()?
so i do it on a server event?
this is my starterpack script btw
local UIS = game:GetService("UserInputService")
local Npc = game.Workspace:WaitForChild("Npc")
local camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local originalCharacter = Player.Character
Player.CharacterAdded:Connect(function(char)
char.Archivable = true
local cloneOrigChar = Player.Character
local npcnow = false
UIS.InputBegan:Connect(function(Key, Chatted)
if Chatted then
return
end
if Key.KeyCode == Enum.KeyCode.E then
if not npcnow then
npcnow = true
camera.CameraSubject = Npc
Player.Character = Npc
elseif npcnow then
npcnow = false
Player.Character = cloneOrigChar
camera.CameraSubject = cloneOrigChar:WaitForChild("Humanoid")
end
end
end)
end)
alr ima go serach that and see
You can’t use UserInputService, nor LocalPlayer on a Server Script
I misread the OP, could you clarify a bit on what you exactly want please?
Also if you are trying to refresh instead of respawn. Find the current cframe of the player’s humanoidrootpart. After you use LoadCharacter(), you can set the humanoidrootpart cframe to the variable you just referenced.
well this script is making me lag more every time i press e so i found out that resetting make the lag reset too…so i want to reset every time i press e so less lag