I am trying to make a Toggle rank Leaderboard by clicking a GUI. But I am not really good at scripting. I am trying to make it so it is only for SHR in my Hotel group. So they can Hide their rank. But when they click the GUI there rank will show.
3 Likes
Is this on a Billboard GUI? Is it on the PlayerList?
it is on the PlayerList. At least that is what I am trying to do.
2 Likes
You’re gonna need a ScreenGui with a TextButton (obviously) and a LocalScript inside of that TextButton.
Aside from that LocalScript, you will need a RemoteEvent in the ReplicatedStorage folder and a Script in ServerScriptService (or workspace)
LocalScript:
local on = true
script.Parent.MouseButton1Down:Connect(function()
on = not on
if on then
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer("OldRank")
else
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent"):FireServer("Guest")
end
end)
Normal Script:
local staff = {["zq86"] = "Staff"}
game.Players.PlayerAdded:Connect(function(p)
local a = Instance.new("Folder",p)
local b = Instance.new("StringValue",a)
a.Name = "leaderstats"
b.Name = "rank"
if staff[string.lower(p.Name)] then
b.Value = staff[string.lower(p.Name)]
end
end)
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent").OnServerEvent:Connect(function(p,newrank)
if staff[string.lower(p.Name)] then
if newrank == "OldRank" then
p:FindFirstChild("leaderstats"):FindFirstChild("rank").Value = staff[string.lower(p.Name)]
else
p:FindFirstChild("leaderstats"):FindFirstChild("rank").Value = newrank
end
end
end)
The table can be changed if you want, this is just an example.
1 Like
It gives off this effect:
Hopefully this is what you were asking for.
1 Like
Thank you so much for the Help! It sure was!
1 Like
You’re welcome. I’m glad to help if you need more!
2 Likes
I am having one little issue.
Got the problem fixed Nvm.