Hello, sorry to bother you. I have an issue with my rating going below 0? I am up to date on the version. There are no errors in output or anything like that.
Hub Server Script:
-- Obtain the service
local smodule = require(game.ServerStorage.SideModule)
local MatchmakingService = require(7567983240).GetSingleton()
-- Set the game place
gameData = MatchmakingService:GetGameData()
MatchmakingService:AddGamePlace("Map 1", 9432073031)
MatchmakingService:SetPlayerRange("Map 1", NumberRange.new(2, 2))
local delayy = 10
MatchmakingService:SetFoundGameDelay(delayy)
-- Queue players (you can call QueuePlayer from anywhere)
game.ReplicatedStorage.rtt.OnServerEvent:Connect(function(player)
local queueonce = player:FindFirstChild("queueonce")
local rawr = player.PlayerGui.PlayScreen.MidBar.TextButton.Frame.Status
local frames = player.PlayerGui.PlayScreen.MidBar.TextButton.Frame
local status = player:FindFirstChild("status")
local tab = {"f", "c"}
local currentlysearching = player:FindFirstChild("cs")
if queueonce.Value == false then
MatchmakingService:QueuePlayer(player, "RankedTest2", "Map 1")
queueonce.Value = true
status.Value = "s"
if currentlysearching.Value == false then
while true do
currentlysearching.Value = true
if status.Value == {"f", "c"} then
currentlysearching.Value = false
break
end
rawr.Text = "Searching"
if status.Value == {"f", "c"} then
currentlysearching.Value = false
break
end
wait(0.4)
rawr.Text = "Searching."
if status.Value == {"f", "c"} then
currentlysearching.Value = false
break
end
wait(0.4)
rawr.Text = "Searching.."
if status.Value == {"f", "c"} then
currentlysearching.Value = false
break
end
wait(0.4)
rawr.Text = "Searching..."
if status.Value == {"f", "c"} then
currentlysearching.Value = false
break
end
wait(0.4)
if status.Value == {"f", "c"} then
currentlysearching.Value = false
break
end
end
end
print("queued")
else
print("Already queued up")
end
end)
game.ReplicatedStorage.cancel.OnServerEvent:Connect(function(plr)
local queueonce = plr:FindFirstChild("queueonce")
local status = plr:FindFirstChild("status")
if queueonce.Value == true then
queueonce.Value = false
end
MatchmakingService:RemovePlayerFromQueueId(plr.UserId)
end)
game.Players.PlayerAdded:Connect(function(plr)
MatchmakingService.FoundGame:Connect(function()
local Players = game:GetService("Players")
print("Found match!")
local frame = plr.PlayerGui.PlayScreen.MidBar.TextButton.Frame
local Status = frame:FindFirstChild("FoundG")
local canc = frame:FindFirstChild("Cancel")
local arr = frame:FindFirstChild("Status")
arr.Visible = false
canc.Visible = false
local status = plr:FindFirstChild("status").Value
status = "f"
Status.Visible = true
frame.Status.Text = "Found Match!"
wait(2)
while true do
Status.Text = "Joining"
wait(0.4)
Status.Text = "Joining."
wait(0.4)
Status.Text = "Joining.."
wait(0.4)
Status.Text = "Joining..."
wait(0.4)
end
end)
local queueonce = Instance.new("BoolValue")
queueonce.Parent = plr
queueonce.Name = "queueonce"
queueonce.Value = false
local status = Instance.new("StringValue")
status.Parent = plr
status.Name = "status"
status.Value = "n"
local cs = Instance.new("BoolValue")
cs.Parent = plr
cs.Name = "cs"
cs.Value = false
end)
game.ReplicatedStorage.rank.OnServerEvent:Connect(function(player, frame)
local rating = MatchmakingService:GetPlayerRating(player, "RankedTest2")
local ratingnu = MatchmakingService:ToRatingNumber(rating)
local ratingnus = ratingnu * 15
local ratingnum = math.ceil(ratingnus)
local frame = player.PlayerGui.PlayScreen.MidBar.Ranks.Frame
frame.Ones.Text = "1v1, MMR: "..ratingnum
if ratingnum < 250 then
frame.Ones.TextLabel.Text = "Silver"
frame.Ones.TextLabel.TextColor3 = Color3.new(0.6, 0.6, 0.6)
frame.Ones.ImageLabel.Image = "http://www.roblox.com/asset/?id=9406476107"
end
if ratingnum > 250 then
if ratingnum < 425 then
frame.Ones.TextLabel.Text = "Gold"
frame.Ones.TextLabel.TextColor3 = Color3.new(0.690196, 0.678431, 0.333333)
frame.Ones.ImageLabel.Image = "http://www.roblox.com/asset/?id=9406479274"
end
end
if ratingnum > 425 then
if ratingnum < 675 then
frame.Ones.TextLabel.Text = "Platinum"
frame.Ones.TextLabel.TextColor3 = Color3.new(0.0745098, 0.415686, 0.509804)
frame.Ones.ImageLabel.Image = "http://www.roblox.com/asset/?id=9406481687"
end
end
if ratingnum > 675 then
if ratingnum < 900 then
frame.Ones.TextLabel.Text = "Diamond"
frame.Ones.TextLabel.TextColor3 = Color3.new(0.192157, 0.270588, 0.54902)
frame.Ones.ImageLabel.Image = "http://www.roblox.com/asset/?id=9406484073"
end
end
if ratingnum > 900 then
if ratingnum < 1240 then
frame.Ones.TextLabel.Text = "Bedrock"
frame.Ones.TextLabel.TextColor3 = Color3.new(0.129412, 0.137255, 0.117647)
frame.Ones.ImageLabel.Image = "http://www.roblox.com/asset/?id=9406489538"
end
end
if ratingnum > 1240 then
frame.Ones.TextLabel.Text = "Emerald"
frame.Ones.TextLabel.TextColor3 = Color3.new(0.352941, 0.552941, 0.266667)
frame.Ones.ImageLabel.Image = "http://www.roblox.com/asset/?id=9406486698"
end
end)
Game server script:
local MatchmakingService = require(7567983240).GetSingleton()
local Module = require(game.ServerStorage.MainModule)
local DataStore = require(1936396537)
-- It's important game servers know how large they can get. You don't really need every map here,
-- but you do need whichever map this is.
-- Tell the service this is a game server
MatchmakingService:SetIsGameServer(true)
MatchmakingService:SetPlayerRange("Map 1", NumberRange.new(2, 2))
local TweenService = game:GetService("TweenService")
started = false
endgame = false
local gameData = nil
local t1 = {}
local t2 = {}
local MMRbefore1 = 0
local MMRbefore2 = 0
-- Basic start function
function Start()
if started == false then
started = true
print("Started")
MatchmakingService:StartGame(gameData.gameCode)
-- Simple teams for a 1v1.
local p = game.Players:GetPlayers()
table.insert(t1, p[1])
table.insert(t2, p[2])
local rating1 = MatchmakingService:GetPlayerRating(p[1], "RankedTest2")
local ratingnu1 = MatchmakingService:ToRatingNumber(rating1)
local ratingnus1 = ratingnu1 * 15
local ratingnum1 = math.ceil(ratingnus1)
MMRbefore1 = ratingnum1
local rating2 = MatchmakingService:GetPlayerRating(p[2], "RankedTest2")
local ratingnu2 = MatchmakingService:ToRatingNumber(rating2)
local ratingnus2 = ratingnu2 * 15
local ratingnum2 = math.ceil(ratingnus2)
MMRbefore2 = ratingnum2
p[1].Character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.Arena.TeleportPlr.CFrame
p[2].Character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.Arena.TeleportPlr2.CFrame
end
end
-- YOU MUST CALL UpdateRatings BEFORE THE GAME IS CLOSED. YOU CANNOT PUT THIS IN BindToClose!
function EndGame(winner)
if endgame == false then
endgame = true
MatchmakingService:UpdateRatings("RankedTest2", {if winner == 1 then 1 else 2, if winner == 2 then 1 else 2}, {t1, t2})
for i, v in ipairs(game.Players:GetPlayers()) do
if table.find(t1,v) == 1 then
if winner == 1 then
local Data1 = DataStore("PB",v)
local amount = math.random(45,75)
local amaz = 75 * 2
local MPS = game:GetService("MarketplaceService")
local GPI = 41074223
local ifprem = false
local ifvip = false
if MPS:UserOwnsGamePassAsync(v.UserId, GPI) then
Data1:Increment(amaz,0)
ifvip = true
end
if v.MembershipType == Enum.MembershipType.Premium then
if ifvip == true then
else
ifprem = true
Data1:Increment(amaz,0)
end
end
if ifvip == false then
if ifprem == false then
Data1:Increment(amount,0)
end
end
local clone = game.ReplicatedStorage.EndScreen:Clone()
clone.Frame.Results.Won.Text = "You won!"
clone.Frame.Results.Made.Text = "MMR: "..MMRbefore1
clone.Frame.Results.ImageLabel.Image = "rbxassetid://9428519351"
clone.Parent = v.PlayerGui
local label = clone.Frame.Results.Made
local arrow = clone.Frame.Results.ImageLabel
local rating1 = MatchmakingService:GetPlayerRating(v, "RankedTest2")
local ratingnu1 = MatchmakingService:ToRatingNumber(rating1)
local ratingnus1 = ratingnu1 * 15
local ratingnum1 = math.ceil(ratingnus1)
local tweenInfoWon = TweenInfo.new(
0.5, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tweenInfoArrow = TweenInfo.new(
0.2, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tween = TweenService:Create(label, tweenInfoWon, {TextTransparency = 1})
local tween2 = TweenService:Create(label, tweenInfoWon, {TextTransparency = 0})
local tween3 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween4 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local tween5 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween6 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local function arrowtween()
repeat
tween3:Play()
wait(0.5)
tween4:Play()
wait(0.5)
tween5:Play()
wait(0.5)
tween6:Play()
wait(0.5)
until wait(3)
end
tween:Play()
wait(0.8)
clone.Frame.Results.Made.Text = "MMR: "..ratingnum1
tween2:Play()
arrowtween:Play()
wait(5)
v:Kick()
end
if winner == 2 then
local Data1 = DataStore("PB",v)
local amount = math.random(1,45)
local amaz = 45 * 2
local MPS = game:GetService("MarketplaceService")
local GPI = 41074223
local ifprem = false
local ifvip = false
if MPS:UserOwnsGamePassAsync(v.UserId, GPI) then
Data1:Increment(amaz,0)
ifvip = true
end
if v.MembershipType == Enum.MembershipType.Premium then
if ifvip == true then
else
ifprem = true
Data1:Increment(amaz,0)
end
end
if ifvip == false then
if ifprem == false then
Data1:Increment(amount,0)
end
end
local clone = game.ReplicatedStorage.EndScreen:Clone()
clone.Frame.Results.Won.Text = "You lost :("
clone.Frame.Results.Made.Text = "MMR: "..MMRbefore1
clone.Frame.Results.ImageLabel.Image = "rbxassetid://9428495112"
clone.Parent = v.PlayerGui
local label = clone.Frame.Results.Made
local arrow = clone.Frame.Results.ImageLabel
local rating1 = MatchmakingService:GetPlayerRating(v, "RankedTest2")
local ratingnu1 = MatchmakingService:ToRatingNumber(rating1)
local ratingnus1 = ratingnu1 * 15
local ratingnum1 = math.ceil(ratingnus1)
local tweenInfoLost = TweenInfo.new(
0.5, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tweenInfoArrow = TweenInfo.new(
0.2, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tween = TweenService:Create(label, tweenInfoLost, {TextTransparency = 1})
local tween2 = TweenService:Create(label, tweenInfoLost, {TextTransparency = 0})
local tween3 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween4 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local tween5 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween6 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local function arrowtween()
repeat
tween3:Play()
wait(0.5)
tween4:Play()
wait(0.5)
tween5:Play()
wait(0.5)
tween6:Play()
wait(0.5)
until wait(3)
end
wait(1.8)
tween:Play()
wait(0.8)
clone.Frame.Results.Made.Text = "MMR: "..ratingnum1
tween2:Play()
arrowtween()
wait(5)
v:Kick()
end
end
if table.find(t2,v) then
if winner == 2 then
local Data1 = DataStore("PB",v)
local amount = math.random(45,75)
local amaz = 75 * 2
local MPS = game:GetService("MarketplaceService")
local GPI = 41074223
local ifprem = false
local ifvip = false
if MPS:UserOwnsGamePassAsync(v.UserId, GPI) then
Data1:Increment(amaz,0)
ifvip = true
end
if v.MembershipType == Enum.MembershipType.Premium then
if ifvip == true then
else
ifprem = true
Data1:Increment(amaz,0)
end
end
if ifvip == false then
if ifprem == false then
Data1:Increment(amount,0)
end
end
local clone = game.ReplicatedStorage.EndScreen:Clone()
clone.Frame.Results.Won.Text = "You won!"
clone.Frame.Results.Made.Text = "MMR: "..MMRbefore2
clone.Frame.Results.ImageLabel.Image = "rbxassetid://9428519351"
clone.Parent = v.PlayerGui
local label = clone.Frame.Results.Made
local arrow = clone.Frame.Results.ImageLabel
local rating1 = MatchmakingService:GetPlayerRating(v, "RankedTest2")
local ratingnu1 = MatchmakingService:ToRatingNumber(rating1)
local ratingnus1 = ratingnu1 * 15
local ratingnum1 = math.ceil(ratingnus1)
local tweenInfoWon = TweenInfo.new(
0.5, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tweenInfoArrow = TweenInfo.new(
0.2, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tween = TweenService:Create(label, tweenInfoWon, {TextTransparency = 1})
local tween2 = TweenService:Create(label, tweenInfoWon, {TextTransparency = 0})
local tween3 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween4 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local tween5 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween6 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local function arrowtween()
repeat
tween3:Play()
wait(0.5)
tween4:Play()
wait(0.5)
tween5:Play()
wait(0.5)
tween6:Play()
wait(0.5)
until wait(3)
end
wait(1.8)
tween:Play()
wait(0.8)
clone.Frame.Results.Made.Text = "MMR: "..ratingnum1
tween2:Play()
arrowtween()
wait(5)
v:Kick()
end
if winner == 1 then
local Data1 = DataStore("PB",v)
local amount = math.random(1,45)
local amaz = 75 * 2
local MPS = game:GetService("MarketplaceService")
local GPI = 41074223
local ifprem = false
local ifvip = false
if MPS:UserOwnsGamePassAsync(v.UserId, GPI) then
Data1:Increment(amaz,0)
ifvip = true
end
if v.MembershipType == Enum.MembershipType.Premium then
if ifvip == true then
else
ifprem = true
Data1:Increment(amaz,0)
end
end
if ifvip == false then
if ifprem == false then
Data1:Increment(amount,0)
end
end
local clone = game.ReplicatedStorage.EndScreen:Clone()
clone.Frame.Results.Won.Text = "You lost :("
clone.Frame.Results.Made.Text = "MMR: "..MMRbefore2
clone.Frame.Results.ImageLabel.Image = "rbxassetid://9428495112"
clone.Parent = v.PlayerGui
local label = clone.Frame.Results.Made
local arrow = clone.Frame.Results.ImageLabel
local rating1 = MatchmakingService:GetPlayerRating(v, "RankedTest2")
local ratingnu1 = MatchmakingService:ToRatingNumber(rating1)
local ratingnus1 = ratingnu1 * 15
local ratingnum1 = math.ceil(ratingnus1)
local tweenInfoWon = TweenInfo.new(
0.5, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tweenInfoArrow = TweenInfo.new(
0.2, -- The time the tween takes to complete
Enum.EasingStyle.Linear, -- The tween style.
Enum.EasingDirection.Out, -- EasingDirection
0, -- How many times you want the tween to repeat. If you make it less than 0 it will repeat forever.
false, -- Reverse?
0 -- Delay
)
local tween = TweenService:Create(label, tweenInfoWon, {TextTransparency = 1})
local tween2 = TweenService:Create(label, tweenInfoWon, {TextTransparency = 0})
local tween3 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween4 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local tween5 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 1})
local tween6 = TweenService:Create(arrow, tweenInfoArrow, {ImageTransparency = 0})
local function arrowtween()
repeat
tween3:Play()
wait(0.5)
tween4:Play()
wait(0.5)
tween5:Play()
wait(0.5)
tween6:Play()
wait(0.5)
until wait(3)
end
wait(1.8)
tween:Play()
wait(0.8)
clone.Frame.Results.Made.Text = "MMR: "..ratingnum1
tween2:Play()
arrowtween()
wait(5)
v:Kick()
end
end
end
end
end
game.Players.PlayerAdded:Connect(function(player)
if not gameData then
gameData = MatchmakingService:GetGameData()
end
if #game.Players:GetPlayers() >= 2 then
if started == false then
Start()
print(gameData.started)
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
if table.find(t1, player) == 1 then
local winner = 2
EndGame(winner)
else
local winner = 1
EndGame(winner)
end
wait()
end)
Thank you for making this module, everything works perfectly except for my rating going below zero. I am on (V2.0.2)