Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can you guys help me make a x2 Coins Event??

Asked by 3 years ago

so if you can integrate a x2 coin event in this code then i will be happy!

(tell me how to make it like with other stuff!)

local MPS = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

local GamePassId = 10211208 -- your gamepass id here
local RespawnTime = 13
local Reward = 10
local Collected = false

function Touch(object)
    if object.Parent:FindFirstChild("Humanoid") then
        if Players:GetPlayerFromCharacter(object.Parent) then
            local Player = Players:GetPlayerFromCharacter(object.Parent)
            local leaderstats = Player:FindFirstChild("leaderstats")
            local Coins = leaderstats:FindFirstChild("Coins")
            if leaderstats ~= nil and Coins ~= nil then
                if not Collected then
                    Collected = true
                    if not MPS:UserOwnsGamePassAsync(Player.UserId, GamePassId) then
                        Coins.Value += Reward
                    else
                        Coins.Value += Reward *2
                    end
                    script.Parent.Transparency = 1
                    script.Parent.CanCollide = false
                    wait(RespawnTime)
                    script.Parent.Transparency = 0
                    script.Parent.CanCollide = true
                    Collected = false
                end
            end
        end
    end
end

script.Parent.Touched:connect(Touch)

Answer this question