I have a network ownership system that uses an object value that has the player’s name as a value. When the value changes to another player’s name, I want to get the last value (last player’s name)
local currentOwner = instance.new("ObjectValue")
local previousOwner = instance.new("ObjectValue")
local function SetOwner(player)
previousOwner.Value = currentOwner.Value
currentOwner.Value = player
script.Parent:SetNetworkOwner(player)
end
Thanks! I was just wondering If i could check if both of the value’s (the player’s name) are on the same team, so I can award the old object value owner a leaderstat.
Code:
local old = ball.OldOwner.Value
local new = ball.Owner.Value
if player.Name == old and player.TeamColor == new.TeamColor then
print("We got a lucky winner!")
end