I have a script and a module script that rewards players for killing players. It also has a multiplier based on whether they have premium or specific gamepasses. I tried debugging, there are no errors, and it seems like it should work as intended.
local CoinMultiplier = require(script:WaitForChild('ModuleScript'))
game.Players.PlayerAdded:Connect(function(player)
local data1 = player:WaitForChild('Data1', 10)
if data1 == nil then return end
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild('Humanoid')
humanoid.Died:Connect(function()
player.leaderstats.Deaths.Value += 1
local tag = humanoid:FindFirstChild('creator')
local killer = tag.Value
if tag and killer then
killer.leaderstats:WaitForChild('Kills').Value += 1
CoinMultiplier(killer)
end
end)
end)
while true do
data1.Time.Value += 1
task.wait(1)
end
end)
module:
local Gamepasses = {
VipPass = 59152368,
CoinsPass = 54456343,
}
local Multipliers = {
CoinValue = 25,
Premium = 1.25,
Vip = 1.5,
x2Coins = 2
}
local function CoinMultiplier(killer)
local MarketplaceService = game:GetService('MarketplaceService')
local PlayerOwnsGamepassAsync = MarketplaceService.UserOwnsGamepassAsync
local multiplier = 1
if killer.MembershipType == Enum.MembershipType.Premium then
multiplier *= Multipliers.Premium
end
if PlayerOwnsGamepassAsync(MarketplaceService, killer, Gamepasses.VipPass, true) then
multiplier *= Multipliers.Vip
end
if PlayerOwnsGamepassAsync(MarketplaceService, killer, Gamepasses.CoinsPass, true) then
multiplier *= Multipliers.x2Coins
end
killer.Data1:WaitForChild('Coins').Value += Multipliers.CoinValue * multiplier
end
return CoinMultiplier