Hey! I’m not so good in scripting so I need help with scripting. I’m making game and I need ranks in leaderboard but I have errors with it.
-- my script
game.Players.PlayerAdded:Connect(function(player)
if game.Players.ItzCrime_bruh.Team["Combine Unit"] then game.Players.ItzCrime_bruh.leaderstats.Rank = "Recruit"
And one thing to note i reccomend you dont use the parent argument in the Instance.new() constructor, as it is slower to initialize than regularly parenting at the bottom
in reset scripts its like if you click on button you die to apply changes on character, team change changes your team
-- reset script
function onButtonClicked()
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
-- team change for citizen
function Click(mouse)
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("White")
end
script.Parent.MouseButton1Down:connect(Click)
-- team change for combine unit
function Click(mouse)
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Maroon")
end
script.Parent.MouseButton1Down:connect(Click)
Ok, so you didn’t added a RemoteEvent to ReplicatedStorage so add it and delete TeamChange and ResetScript and change LocalScript to:
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer(script.Parent.Text) -- this changes player team and rank
game.Players.LocalPlayer.Character.Humanoid.Health = 0
end)