I was revisiting a very old game of mine when I came across this script I tried to fix the local functions but it says I have errors and I don't know how to fix them.
local function awardwin(player) if player then local mydata = playerdata[player.userId] local leaderstats = player:FindFirstChild("leaderstats") if leaderstats and mydata then mydata.wins = mydata.wins + 1 local winsvalue = leaderstats:FindFirstChild("Wins") if winsvalue then winsvalue.Value = mydata.wins end end end end
function awardpoints(player, points) if player and points then local mydata = playerdata[player.userId] if mydata then mydata.points = mydata.points + points local pointsvalue = player:FindFirstChild("Points") if pointsvalue then pointsvalue.Value = mydata.points end end end end
local function dropnetgun(pos) local pickup = serverstorage:WaitForChild("Net Gun"):WaitForChild("Handle"):clone() pickup.Name = "Pickup" pickup.Anchored = true pickup.CanCollide = false pickup.CFrame = CFrame.new(pos)
local sparkles = Instance.new("Sparkles")
sparkles.SparkleColor = Color3.new(0, .5, 1)
sparkles.Parent = pickup
local given = false
pickup.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and player ~= bloxxer then
local backpack = player:FindFirstChild("Backpack")
if backpack and not given then
given = true
pickup:remove()
local netgun = serverstorage:WaitForChild("Net Gun"):clone()
netgun.Parent = backpack
sheriff = player
end
end
end
end)
for _, player in pairs(game.Players:GetChildren()) do
if player and player.Character and player.Character.Parent then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid and humanoid.WalkSpeed < 16 then
humanoid.WalkSpeed = 16
end
end
end
debris:AddItem(pickup,roundtime)
pickup.Parent=game.Workspace
end
local function newcharacter(bloxxedplayer, character) local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.Died:connect(function()
if bloxxedplayer == sheriff then
humanoid:UnequipTools()
local backpack = bloxxedplayer:FindFirstChild("Backpack")
if backpack then
backpack:ClearAllChildren()
end
local torso = character:FindFirstChild("Torso")
if torso then
dropnetgun(torso.Position)
end
end
local tag = humanoid:FindFirstChild("creator")
if tag and tag.Value and tag.Value.Parent == game.Players then
if tag.Value ~= bloxxer and bloxxedplayer ~= bloxxer then
local wrongdoer = tag.Value
if wrongdoer.Character and wrongdoer.Character.Parent then
local wrongdoerhumanoid = wrongdoer.Character:FindFirstChild("Humanoid")
if wrongdoerhumanoid then
wrongdoerhumanoid.Health = 0
end
end
end
end
end)
end
end
local function playeradded(player) local leaderstats = Instance.new("IntValue") leaderstats.Name = "leaderstats"
local mydata = datastore:GetAsync(player.userId) or {}
mydata.points = mydata.points or 0
mydata.wins = mydata.wins or 0
mydata.multiplier = mydata.multiplier or 1
mydata.emeraldsword = mydata.emeraldsword or 0
playerdata[player.userId] = mydata
local wins = Instance.new("IntValue")
wins.Name = "Wins"
wins.Value = mydata.wins
wins.Parent = leaderstats
local points = Instance.new("IntValue")
points.Name = "Points"
points.Value = mydata.points
points.Parent = player
