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

Reset button after reaching level 100. (?)

Asked by 5 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

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?

0
Where is the players level stored? Is it a variable or a book object? royaltoe 5144 — 5y
0
Object value* royaltoe 5144 — 5y
0
this isnt a request site, please include the code that you tried theking48989987 2147 — 5y
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. QuikSilver09 5 — 5y
View all comments (2 more)
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) SteelMettle1 394 — 5y
0
do it yourself nrd Fifkee 2017 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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)    
Ad

Answer this question