Hey Robloxians,
I am making a ranked pvp sort of thing in my game, problem that I am trying to make it like if you eliminate a player outside that place you will get 5 points but if you eliminate player inside that place, you will get 5+3 points and it doesn’t seem to be working.
Here are the scripts:
Kill for cash script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
Character.Humanoid.Died:Connect(function(Died)
local creator = Character.Humanoid:FindFirstChild("creator")
local leaderstats = creator.Value:FindFirstChild("leaderstats")
if creator ~= nil and creator.Value ~= nil then
leaderstats.OOFs.Value = leaderstats.OOFs.Value + 5
end
end)
end)
end)
And the broken +3 points script:
local bonusPart = game.Workspace.Areas.Main2
local coinValue = 1
local bonusCoinValue = 2
local remoteEvent = game.ReplicatedStorage.OOF_Ranked8
local function onPlayerDied(player)
if player and player:IsA("Player") then
local killer = player:FindFirstChild("creator")
if killer and killer:IsA("Player") then
local coinAmount = coinValue
if bonusPart:IsDescendantOf(killer.Character) then
coinAmount = bonusCoinValue
end
killer.leaderstats.OOFs.Value = killer.leaderstats.OOFs.Value + coinAmount
remoteEvent:FireAllClients(killer, coinAmount)
end
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
onPlayerDied(player)
end)
end)
end)