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

The Button Disepars if i set transparency to 1 Help is appreciate :D ?

local ButtonModel = script.Parent
local Object = ButtonModel.Object
local Cost = ButtonModel.Cost
local Dependency = ButtonModel.Dependency
local Button = ButtonModel.Head
local Text = Button.BillboardGui.TextLabel

Text.Text = Object.Value.Name.." - "..tostring(Cost.Value).."€"

if Dependency.Value == "None" then
	for i,v in pairs(Object.Value:GetChildren()) do
		if v:IsA("BasePart") then
			v.Transparency = 1
			v.CanCollide = false
		elseif v:IsA("TextLabel") then
			v.TextTransparency = 1		
		end
	end
else
	for i,v in pairs(ButtonModel:GetChildren()) do
		if v:IsA("BasePart") then
			v.Transparency = 1
			v.CanCollide = false
		elseif v:IsA("TextLabel") then
			v.TextTransparency = 1		
		end
	end
	for i,v in pairs(Object.Value:GetChildren()) do
		if v:IsA("BasePart") then
			v.Transparency = 1
			v.CanCollide = false
		elseif v:IsA("TextLabel") then
			v.TextTransparency = 1		
		end
	end
	if workspace.Buyed:FindFirstChild(Dependency.Value) then
		for i,v in pairs(ButtonModel:GetChildren()) do
			if v:IsA("BasePart") then
				v.Transparency = 0
				v.CanCollide = true
			elseif v:IsA("TextLabel") then
				v.TextTransparency = 0	
			end
		end
	end
end

Button.Touched:Connect(function(Hit)
	if Hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
		local Cash = player.leaderstats.Euro
		if Cash.Value >= Cost.Value then
			Cash.Value = Cash.Value + Cost.Value
			for i,v in pairs(Object.Value:GetChildren()) do
				if v:IsA("BasePart") then
					v.Transparency = 0
					v.CanCollide = true
				elseif v:IsA("TextLabel") then
					v.TextTransparency = 0		
				end
			end
			for i,v in pairs(ButtonModel:GetChildren()) do
				if v:IsA("BasePart") then
					v.Transparency = 1
					v.CanCollide = false
				elseif v:IsA("TextLabel") then
					v.TextTransparency = 1		
				end
			end
			ButtonModel.Parent = workspace.Buyed
		end	
	end
end)

Don't be scared it's looking kinda hard but it's just simple script :D ok so If dependency is something other it's automaticly diseapers

1 answer

✓ Accepted answer

What's the issue here - like what is not working properly for you and you want to fix? I'm assuming you don't want the button to disappear? Transparency 1 = invisible, transparency 0 = visible, anything inbetween is transparent.

2 comments

0

Thank you

0

Sorry i actually forget to anchor it so if i launch from rpg it will fling into void

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