I want a Job system in which when you choose your job, i'll change your "Job" on the leaderboard, this works with StringValues but I can't get it to work, any help? heres the script
**game.Players.PlayerAdded:connect(function (p) local lead = Instance.new("IntValue") lead.Name = "leaderstats" local rank = Instance.new("StringValue", lead) rank.Name = "Job" rank.Value = "Unemployed" rank.Parent = lead --wait() lead.Parent = p --print(rank:GetFullName())
game.StarterGui.ScreenGui.Frame.TextLabel.Farmer.TextButton.MouseButton1Click:Connect(function(cat) local function cat() if rank.Value == "Unemployed" then rank.Value.Changed = "Farmer" else rank.Value = "Unemloyed" end
end end)
end)**
Okay I found your issue (hopefully):
This line game.StarterGui.ScreenGui.Frame.TextLabel.Farmer.TextButton.MouseButton1Click:Connect(function(cat)
You can Simplify this by using LocalScript
, but instead of game.StarterGui
, use player.PlayerGui
since StartGui is a service and can do nothing. and what is at fault is the if statement
.
Just simplify the script by doing:
button.MouseButton1Click:Connect(function() rank.Value = "Farmer" end)