Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
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~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

0
The main error is on line 51 DefinitelyNotTronix 19 — 3y
0
no, 50 poppyloverb 20 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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.

0
Thanks DefinitelyNotTronix 19 — 3y
Ad

Answer this question