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

so i was making a tycoon from codakid and when i step on a button it will not work i need help?

so here is the script:

local button = script.Parent.Button

function steppedOn(part)
	
	local character = part.Parent
	local player = game.Players:GetPlayerFromCharacter(character)
	if player and player == script.Parent.Parent.Parent:FindFirstChild('Owner').Value then
			local moneyAmount = player:FindFirstChild('leaderstats'):FindFirstChild('Cash')
			
			if moneyAmount.Value >= script.Parent.Cost.Value then
			
			moneyAmount.Value = moneyAmount.Value - script.Parent.Cost.Value
			
			for i, child in ipairs(script.Parent.Target.Value:GetChildren()) do
				
				if child.ClassName == 'Part' then
					
					child.Transparency = 0
					if child.Name ~= 'DropLocation' then
						child.CanCollide = true
					end
					
				end
				
			end
			if script.Parent.Target.Value:FindFirstChild('Activated') then
				script.Parent.Target.Activated.Value = true
			end
			
			for i, button in ipairs(script.Parent.Unlocks:GetChildren()) do
				button.Value.Button.Transparency = 0
				button.Value.Button.CanCollide = true
			end
			
			script.Parent:Destroy()
			
		end
		
	end
	
end
button.Touched:Connect(steppedOn)
for i, button in ipairs(script.Parent.Unlocks:GetChildren()) do
	button.Value.Button.Transparency = 1
	button.Value.Button.CanCollide = false
end
  • there is a target on the object
  • i have a script error that says Workspace.Tycoon.Buttons.BuyDropper2.Script:44: attempt to index nil with 'Button'

1 answer

Maybe try changing the value's name inside of the button.

14 comments

0

i have it at $25 and on the leaderboard i have $25

0

what

0

i changed head on local button = script.Parent.Head to script.Parent.Button and it did not work

0

line 31

0

not 1.........................

0

'Part',script

0

what should it say?

0

is it on line 3 or 31

0

31 and 32

0

what should it say?

0

something instead of value just change thename and edit it

0

what

0

bye

0

back

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