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

Reset button after reaching level 100. (?)

Who can help - help, urgently needed. I need a script that will make it so that when the PLAYER reaches level 100, the RESET button will appear on the screen. I tried to write a script, it didn’t work, please help. Additionally: how to make sure that all the weapons that the player received disappear after a reset?

6 comments

0

Where is the players level stored? Is it a variable or a book object?

0

Object value*

0

this isnt a request site, please include the code that you tried

0

You could have an event check when your level is changed, check if it is lvl 100, then make the gui visible and go from there. I don't think anyone is willing to write it all out for you here though.

0

I would tie this into what ever GUI you have for the player to check stats and such. Then have the client only make the button visible if the returned value from the server is 100+. Then have the reset button connect to the server to verify the player's level, and if they meet the requirements, reinitialize their data (and give whatever reset boost you plan on giving)

0

do it yourself nrd

1 answer

just add an event listener that listens for changes in the player's level.. for example:

make sure you listen changes server side, because the client could change the values and the reset button will appear..

game.Players.PlayerAdded:Connect(function(player)
	local stats = Instance.new("Folder",player)
	local level = Instance.new("IntValue",stats)
	stats.Name = "Level";
	--load data from data store or create new data if there is none in datastore..
	level.Value = --[set to value returned from data store or an initial value.]
	
	level.Changed:Connect(function()
		if(leve.Value >= 100) then
			print("player has reached level 100")
			local reset_button = player.PlayerGui.x.x.x-- set to where the reset button is
			reset_button.Visible = true
			reset_button.MouseButton1Down:Connect(function()
				local character = player.Character
				character:WaitForChild("Humanoid"):UnequipTools();
				--code to remove weapons
			end)
		end
	end)

end)	

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