I am trying to use a script to reset a character with the click of a button can anyone help me doing that?
Thanks!
I am trying to use a script to reset a character with the click of a button can anyone help me doing that?
Thanks!
Use a remote event and use player:LoadCharacter()
Example:
Local script:
local debounce = false
script.Parent.MouseButton1Click:COnnect(function()
if not debounce then
debounce = true
game.ReplicatedStorage.RemoteEvent:FireServer() -- change this remote event to your remote event
wait(3)
debounce = false
end
end)
Server Script:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
plr:BreakJoints()
wait(3)
plr:LoadCharacter()
end)
This would be my approach.
Local Script
local event = *pathToEvent*
local button = *pathToButton*
button.MouseButton1Down:Connect(function()
event:FireServer()
end)
Server Script
local event = *pathToEvent*
event.OnServerEvent:Connect(function(player)
player:LoadCharacter()
end)
Thanks This Works Very Well.
You said the same thing as the guy in the solution but thanks for your help.