Hello! I wanted to know why this system for my quests returns indexing nil for the playerAmount. This code is in a local script in Starter Gui.
while true do
local Req1 = script.Parent.Parent.Parent:WaitForChild("QuestREQ")
local Req2 = script.Parent.Parent.Parent:WaitForChild("QuestREQ2")
local Prompt = script.Parent.Parent.Parent:WaitForChild("Prompt")
local playerAmount = game.Players.LocalPlayer.items:FindFirstChild(Req1.Value)
script.Parent.Text = Prompt.Value.." "..playerAmount.Value
wait(1)
end
Players.SloppyBanana225.PlayerGui.Quests.Frame.TextLabel.LocalScript:7: attempt to index nil with âValueâ - Client - LocalScript:7
09:10:14.155 Stack Begin - Studio
09:10:14.155 Script âPlayers.SloppyBanana225.PlayerGui.Quests.Frame.TextLabel.LocalScriptâ, Line 7 - Studio - LocalScript:7
09:10:14.155 Stack End - Studio
local Req1 = script.Parent.Parent.Parent:WaitForChild("QuestREQ")
local Req2 = script.Parent.Parent.Parent:WaitForChild("QuestREQ2")
local Prompt = script.Parent.Parent.Parent:WaitForChild("Prompt")
local player = game.Players.LocalPlayer
local playerAmount = player.items:WaitForChild(tostring(Req2.Value))
local TextLabel = script.Parent
TextLabel.Text = Prompt.Value.." "..playerAmount.Value
playerAmount:GetPropertyChangedSignal("Value"):Connect(function()
TextLabel.Text = Prompt.Value.." "..playerAmount.Value
end)
script.Parent.MouseButton1Click:Connect(function()
local Req1 = script.Parent.Parent.Parent:WaitForChild("QuestREQ")
local Req2 = script.Parent.Parent.Parent:WaitForChild("QuestREQ2")
local Prompt = script.Parent.Parent.Parent:WaitForChild("Prompt")
local Type = script.Parent.Parent.Parent:WaitForChild("Type")
local Who = script.Parent.Parent.Parent:WaitForChild("Who")
local playerVal = game.Players.LocalPlayer.items:FindFirstChild(Req2.Value)
Prompt.Value = Type.Value.." "..Req1.Value.." "..Req2.Value.." "..Who.Value.." "..playerVal.Value.."/"..Req1.Value
script.Parent.Parent.Visible = false
end)
Now this is my code in the accept button, but how would I make that last bit playerVal, load when the player was updated? It now âworksâ though.