I'm working on a system that runs a RemoteEvent when a gui button is pushed.
Here we have a simplified version of my script that should provide all non functioning details.
local rem = "!armspurchase"
local user = game.Players.LocalPlayer
local Armors = {"GoldArmor", "SteelArmor"}
for i = 1, #Armors do
local Pass = user.PlayerGui.ScreenGui:findFirstChild(Armors[i].Name).TextButton
Pass.MouseButton1Down:Connect(function()
game:GetService("ReplicatedStorage"):FindFirstChild(rem):FireServer(user.Name, Armors[i].Name)
end)
end
For some reason, even though everything is accounted for, it tells me that I'm trying to index a nil value on line 8???

1 comment
Don’t forget to accept this answer if it works out:3