Hello all, I am creating a World-Base multiplayer RPG Adventure Zombie game, and I've run into a SERIOUS problem!
My pop-up shop gui won't work! I can get the GUI to pop-up when the player touches the appropriate brick, but the ImageButtons in the SHOP GUI do NOT function as coded, and I cannot see as to why! The error I sometimes get(not all the time), is that "Chips is not a valid member of IntValue", But the code, without errors, creates the proper folder, and "Chips" IS a proper IntValue according to the test!
Here's my Shop UI code:
script.Parent.MouseButton1Click:Connect(function()
local RS = game:GetService("ReplicatedStorage")
local item = RS:WaitForChild("Glock")
local price = 250
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
if stats.Chips.Value>=price then
stats.Chips.Value = stats.Chips.Value - price
local cloned = item:Clone()
cloned.Parent = player.Backpack
cloned.Parent = player.StarterPack
end
end)
Here is my leaderstats code:
game.Players.PlayerAdded:Connect(function(plr)
local fold = Instance.new("Folder", plr)
fold.Name = "leaderstats"
local val = Instance.new("IntValue", fold)
val.Name = "Chips"
end)
while true do
wait(5)
for i, v in pairs (game.Players:GetChildren ()) do
if v:FindFirstChild ("leaderstats") ~= nil then
if v.leaderstats:FindFirstChild("Chips") ~= nil then
v.leaderstats.Chips.Value = v.leaderstats.Chips.Value + 1000
end
end
end
end
