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

How to fix an "index upvalue" error in a Grid-Placement Tycoon?

Asked by 4 years ago

I am getting a problem that says:

Players.Awesomemode14.PlayerGui.BuildUI.ClientPlacement:22: attempt to index upvalue 'plot' (a nil value)

and

Players.Awesomemode14.PlayerGui.BuildUI.ClientPlacement:18: attempt to index upvalue 'plot' (a nil value)

Here is the code where the problem starts:

local placementModule = require(game.ReplicatedStorage.Modules.PlacementModuleV2)
local plot

local remote = game.ReplicatedStorage.Events.PlaceObj

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local parent = script.Parent.MainFrame
local TestButton = parent.Part
local DropperOneButton = parent.Dropper1

game.ReplicatedStorage.Events.ClientPlot.OnClientEvent:Connect(function(pltNm)
    plot = workspace.Plots:FindFirstChild(pltNm)
end)

TestButton.MouseButton1Click:Connect(function()
    placementModule:new("TestPart", game.ReplicatedStorage.Models, plot.Plot, plot.PlacedObjects, false, true)
end)

DropperOneButton.MouseButton1Click:Connect(function()
    placementModule:new("Dropper1", game.ReplicatedStorage.Models, plot.Plot, plot.PlacedObjects, false, true)
end)

mouse.Button1Down:Connect(function()
    placementModule:Finish(remote)
end)

And I uploaded this to Roblox to access the dataStore

Thanks for the help!

0
You're probably not firing the ClientPlot event which is why plot is nil royaltoe 5144 — 4y
0
What do you mean? awesomemode14 68 — 4y
0
Thanks for the help! @royaltoe awesomemode14 68 — 4y

Answer this question