Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make script stay after resetting? - Class System Game


I'm still a novice scripter, so I don't know too much about scripting well

So I've successfully made a TextButton that when you click it, it:

  • waits 5 seconds to prevent from leaving too quickly
  • teleports you to spawn
  • gives you certain set of tools
  • changes your health and maxhealth

So all of that works.

The main problem is, if you reset, all of your stuff is gone, and you'd have to go through the whole process again

The script is

textButton = script.Parent

spawns = {game.Workspace.SpawnLocation1 , game.Workspace.SpawnLocation2 , game.Workspace.SpawnLocation3 , game.Workspace.SpawnLocation4}


player = script.Parent.Parent.Parent.Parent

Trowel = game.ReplicatedStorage.ClassicTrowel:Clone() 


textButton.MouseButton1Down:connect(function()
	wait(5)
	player.Character:MoveTo(spawns[math.random(1, #spawns)].Position)
	player.Character.Humanoid.MaxHealth = 200
	player.Character.Humanoid.Health = 200
	Trowel:Clone().Parent = player.Backpack 
	

end)

Thanks for reading! (I'm constantly editing since I'm new to Scripting Helpers)

1 answer

make a new Script and place it into StarterGui

copy and paste this one line:

game.StarterGui.ResetPlayerGuiOnSpawn = false

1 comment

0

Can you read the entire post please, because I said that it gives different health and TOOLS, When I tried in both script and local script it didn't work. I also did it with playerGUI and player and that didn't work either

This discussion is preserved as it was. New answers, comments, and votes are closed.