Is there any way to resetting localplayer game?

Ah I think I get what you mean.

Just copy the default map and parent it to replicated storage and clone and take it out as needed?

Then just adapt your code a lot to be resettable - I don’t think there’s many other solutions. A viewportframe may work but it won’t be very performant

Well no not that, that is far away from what i want to do xd

It seems any way to reset localplayer game is teleporting to other server right ?

I just want to check if there is any spesific codes for that

Go to bed

Another alternate I suppose you could use is TeleportToPrivateServer if you want the player to teleport in the same place

local TPService = game:GetService("TeleportService")
local Button = script.Parent
local Player = game.Players.LocalPlayer
local GuiToReplace = --GuiObject here

local CustomLoadingCheck = TPService:GetArrivingTeleportGui()

if CustomLoadingCheck then
    game.ReplicatedFirst:RemoveDefaultLoadingScreen()
    local playerGui = Player:WaitForChild("PlayerGui")
    ReplicatedFirst:RemoveDefaultLoadingScreen()
    customLoadingScreen.Parent = playerGui
    -- animate screen here
    wait(5)
    -- destroy screen
    customLoadingScreen:Destroy()
end 

Button.MouseButton1Down:Connect(function()
    local Code = TPService:ReserveServer(game.PlaceId)

    TPService:TeleportToPrivateServer(game.PlaceId, Code, {Player}, GuiObject)
end)

I think I mixed up something idk what

1 Like

Im confused. You want the server to be reset. There isn’t any way other than either storing your default map and taking it out as needed, creating a new server with teleports or making your code able to be reset intentionally.

1 Like

Well i dont want to reset a server. Like when you joining a game whole code are working i want to do something like that

This could work, but he doesn’t want a generic title card to be pulled up while the server teleports to reset.

Go to bed man i dont want to steal your sleeping time xd

Maybe just disable all the scripts then re-enable them? Idk, not sure what you even want at this point.

Hmm great idea but its really gonna work ?

Ohhh so you want specific functions to fire?

Why not make a bindable event to do that? Just wrap your code in a function, call it once, then create a connection using a bindable event to call the function.

local myEvent = game:GetService(‘ReplicatedStorage’).Event

local function doStuff()
    -- do whatever you need here
end

doStuff() -- call when the server first starts up
myEvent.Event:Connect(doStuff)

For me, the easiest way to make a reset function is to save a map state and to collect all the connections into one array and disconnect them all. After that, we can reconnect everything.

1 Like

Well not like that either, i mean is there a any spesific code to reset all scripts and works scripts like their first time working

Couldn’t you just put all the scripts in a place where they’re secured, then clone & parent them into ServerScriptService so that they’ll run for the first time as they’re cloned?

Usually toggling script.Disabled twice should do the trick, but I really don’t think you should do that as it doesn’t reset any object states

You have to disable and enable them as @robloxcommunityplus said or wrap them in a function and create a connection using some sort of event which is what I put in my post

2 Likes

Okey guys i will come back later i need to do a some quick thing to do

Kk I’ll be dropping out, it’s 11:01 PM and I’m starting to think other apps I type in are the devforum lol

2 Likes