Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

2x Diamonds Working Yesterday But Not Now?

I've made this script for a diamond that we have scattered all across out simulator map. its supposed to give double diamonds if you have a gamepass. And it was working fine but now it doesnt seem to work at all. The script is inside the part.

local Part = script.Parent
local id = 10974987 
amnt = 10

Part.Touched:Connect(function(HIT)
	local H = HIT.Parent:FindFirstChild("Humanoid")	
	if H then
		local player = game.Players:GetPlayerFromCharacter(HIT.Parent)	
if player then
			if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id)then
		player.leaderstats.Diamonds.Value = player.leaderstats.Diamonds.Value + amnt * 2
		script.Parent.Coin:Play()
		script.Parent.Transparency = 1
		script.Disabled = true
		wait(10)
		script.Parent.Transparency = 0
		script.Disabled = false
		end
else
		player.leaderstats.Diamonds.Value = player.leaderstats.Diamonds.Value + amnt * 1
		script.Parent.Coin:Play()
		script.Parent.Transparency = 1
		script.Disabled = true
		wait(10)
		script.Parent.Transparency = 0
		script.Disabled = false

		end
	end
end)

1 answer

local Part = script.Parent
local id = 10974987 
amnt = 10

Part.Touched:Connect(function(HIT)
    local H = HIT.Parent:FindFirstChild("Humanoid") 
    if H then
        local player = game.Players:GetPlayerFromCharacter(HIT.Parent)  
if player then
            if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id)then
        player.leaderstats.Diamonds.Value = player.leaderstats.Diamonds.Value + amnt * 2
        script.Parent.Coin:Play()
        script.Parent.Transparency = 1
        script.Disabled = true
        wait(10)
        script.Parent.Transparency = 0
        script.Disabled = false
        end
else
        player.leaderstats.Diamonds.Value = player.leaderstats.Diamonds.Value + amnt * 2
        script.Parent.Coin:Play()
        script.Parent.Transparency = 1
        script.Disabled = true
        wait(10)
        script.Parent.Transparency = 0
        script.Disabled = false

        end
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.