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

I doing a Roblox Tycoon Kit and its have error can you help me?

TheErrorMessage: Workspace.TronixsTycoonKit.TycoonHandle:47: attempt to index nil with 'Value' 




local Settings = require(workspace.TronixsTycoonKit.Settings)
local TeamService = game:GetService("Teams")
local Tycoon
local Player
local Character
local Owner
local Gate
local Bool = true
local leaderstats = workspace.TronixsTycoonKit.Leaderstats.Value
workspace.Sounds.Sound1.SoundId = Settings.Sounds.CollectMoney
workspace.Sounds.Sound2.SoundId = Settings.Sounds.ErrorBuy
workspace.Sounds.Sound3.SoundId = Settings.Sounds.SuccesBuy

for i,v in pairs(script.Parent.Tycoons:GetChildren()) do
	Tycoon = v
	local Index = i
	Owner = v.Owner.Value
	Gate = v.Entrance.Gate.TouchPart
	Gate.Touched:Connect(function(Char)
		if Char.Parent:FindFirstChildWhichIsA("Humanoid") then
			Character = Char.Parent
			Gate.Transparency = 0.4
			Owner = Character.Name
			Gate.BillboardGui.TextLabel.Text = Owner.."'s Tycoon"
			Player = game.Players:GetPlayerFromCharacter(Character)
--[[			Player.Team = PlayersTeam
			print(Player.Team) --]]
		end
	end)
end
for i,v in pairs(Tycoon.Buttons:GetChildren()) do
	if v:FindFirstChild("Dependency") then
		print(v.Name.." Is Have Dependency")
	else
		local Model = v.Object.Value
		for I,V in pairs(Model:GetDescendants()) do
			if V:IsA("Part") then
				V.Transparency = 1
			end
			v.Button.Touched:Connect(function(Char)
				if Bool == true then
					Bool = false
					if Char.Parent:FindFirstChildWhichIsA("Humanoid") then
						if Char.Parent == Character then
							if Character.Name == Owner then
								if leaderstats.Value >= v.Cost then
									workspace.Sounds.Sound3:Play()
									if V:IsA("Part") then
										v:Destroy()
										wait(0.2)
										V.Transparency = 0.9
										wait(0.2)
										V.Transparency = 0.8
										wait(0.2)
										V.Transparency = 0.7
										wait(0.2)
										V.Transparency = 0.6
										wait(0.2)
										V.Transparency = 0.5
										wait(0.2)
										V.Transparency = 0.4
										wait(0.2)
										V.Transparency = 0.3
										wait(0.2)
										V.Transparency = 0.2
										wait(0.2)
										V.Transparency = 0.1
										wait(0.2)
										V.Transparency = 0
									elseif V:IsA("Script") then
										V.Disabled = false
									end
								else
									workspace.Sounds.Sound2:Play()
								end
							end
						end
					end 
					wait(1)
					Bool = true
				end
			end)
		end
	end
end~~~~~~~~~~~~~~~~~


2 comments

0

The main error is on line 51

0

no, 50

1 answer

✓ Accepted answer

well, line 51 says v.Cost, and it's comparing it to an Integer value, it should be v.Value, since I am assuming "v" is an Integer value.

so try changed line 51 to:

if leaderstats.Value >= v.Cost.Value then

if that doesnt work, then try:

if leaderstats.Value >= v.Value then

hopefully that helps, since i think "v" is an integer value, or cost is the integer value.

1 comment

0

Thanks

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