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

Ranking and powering Items?

Asked by 2 years ago

I'd like to make some items spawner that give an items that give you a rank and some powers. the items will respawn after some time. I'd like also to insert in the tab a rank show. I alredy have my tab, i only need to know how to show ranks How can I do it?

1 answer

Log in to vote
0
Answered by 2 years ago

To show ranks in your tab, you can create a new text label in your tab UI and bind it to a variable that holds the player's rank. Then, whenever the player's rank changes, you can update the text label to reflect the new rank.

To create the rank system and the respawning items, you can create a function that checks for the player's rank and gives them the corresponding powers. This function can be called whenever the player touches the spawning items. You can also create a timer that triggers the respawning of the items after a certain amount of time has passed.

Here is an example of how this can be implemented in Lua:


-- Create a variable to hold the player's rank local playerRank = 1 -- Function to check the player's rank and give them powers function checkPlayerRank(player) if playerRank == 1 then -- Give player rank 1 powers elseif playerRank == 2 then -- Give player rank 2 powers end end -- Function to handle player touching the spawning items function OnItemTouch(item) -- Increment player's rank playerRank = playerRank + 1 -- Give player the corresponding powers checkPlayerRank(player) end -- Create a timer to handle the respawning of the items local respawnTimer = game:GetService("RunService").Stepped:Connect(function() -- Check if the items are ready to respawn if item.Transparency == 1 then item.Transparency = 0 end end) -- Update the text label in the tab UI to show the player's rank tab.RankLabel.Text = "Rank: " .. playerRank
Ad

Answer this question