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

Special Regeneration Script Not Working Right?

I'm trying to make a special clickable model regeneration script that can only be used if you have a certain pass. I have been messing around and I created this (script below) but it doesn't work like it should, any suggestions on how I can fix this?

Script:

local buf = script.Parent.Parent.Canoe1:clone()
local deb = false
local ID = 1268461443
local CLICK_BLOCK = script.Parent
local ITEM_ID = 1268461443

function hit()
	if game:GetService("GamePassService"):PlayerHasPass(Player, ID) true then
		if deb == true then return end
		deb = true
		local new = buf:clone()
		new.Parent = game.Workspace
		new:MakeJoints()
		script.Parent.BrickColor = BrickColor.new(21)
		wait(20)
		script.Parent.BrickColor = BrickColor.new(28)
		deb = false
	else
		game:GetService("MarketplaceService"):PromptPurchase(ITEM_ID)
	end
end

script.Parent.Click.MouseClick:connect(hit)

1 answer

I think one of your problems may be that you're using a hit function instead of a click, but I am not sure of this. I made an updated script that I believe should work.

local buf = script.Parent.Parent.Canoe1:Clone()
local id = 1268461443
local deb = false
local CLICK_BLOCK = script.Parent
 
script.Parent.MouseButton1Click:Connect(function()
    if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
if deb == true then
buf.Parent = game.Workspace
        buf:MakeJoints()
        script.Parent.BrickColor = BrickColor.new("Really red") --If you're going to use BrickColor, use the name of your color
        wait(20)
        script.Parent.BrickColor = BrickColor.new("Lime green") 
deb = false
    end
end
end)

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