Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

make a new Script and place it into StarterGui

copy and paste this one line:

game.StarterGui.ResetPlayerGuiOnSpawn = false
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 SpazzMan502 133 — 9y
Ad

Answer this question