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

Error on line 5 tells me to try to index null with "Unicorns" in which it fails?

Asked by 4 years ago
local uni = game.Workspace:FindFirstChild("Devs")

local playerInventory = game.ReplicatedStorage:FindFirstChild("Inventory")

local uniAmount = playerInventory.Unicorns

local player = game.Players.LocalPlayer

local throwPartyBtn = game.StarterGui.PartyGui.ThrowPartyButton

local throwParty = throwPartyBtn.CallOver --CallOver is a remote event btw



uniAmount = 1000

tradablePet = 1 --Boolean logic, here



if uniAmount == 1000 then

    repeat

        playerInventory.Instance.new(uni)

        new(uni).tradablePet = 1

    until uniAmount == 64794763839
end


if uniAmount <1000 then

    player:Kick ("Error with the auto farm.")
end



throwPartyBtn.MouseButton1Click:Connect(function()

uniAmount = 0

wait(1)

uniAmount = 999 --we want to chill the servers a bit here

wait(1)

new(uni).tradablePet = 0

wait(1)

new(uni).tradablePet = 1

throwParty = false

throwParty = (uni) end)
--something to confuse the rStorage and configure it the way want it to

Error on line 5 tells me to try to index null with "Unicorns" in which it fails?

0
playerInventory must return nil...meaning it does not exist ForeverBrown 356 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Try doing this instead:

local playerInventory = game.ReplicatedStorage:WaitForChild("Inventory")

Hope this helps!

Ad

Answer this question