Hello! when I tried making a shop Gui the unequipped button wasnt working it says when I own it whenever I click the unequip button it says " Not enough bytes "
Also a weird problem is happening when it says that the bomb is " on " not inside of server Storage
what came in the output
11:42:02.432 BackroundColor3 is not a valid member of TextButton "Players.Player1.PlayerGui.Shop.MainFrame.SafeArea.ItemInformation.InfoFrame.BuyButton" - Client - Core:108
Also this came in the output
11:41:38.522 Bomb is not a valid member of ServerStorage "ServerStorage" - Server - MainScript:73
11:41:38.522 Stack Begin - Studio
11:41:38.522 Script 'ServerScriptService.MainScript', Line 73 - Studio - MainScript:73
11:41:38.522 Stack End - Studio
The Script for the core
-- Core UI localscript
local availableTools = game.ReplicatedStorage:WaitForChild("GetTools"):InvokeServer()
local mainFrame = script.Parent:WaitForChild("MainFrame")
local safeArea = mainFrame:WaitForChild("SafeArea")
local itemInformation = safeArea:WaitForChild("ItemInformation")
local infoFrame = itemInformation.InfoFrame
local selectedItem = itemInformation.SelectedItem
local equippedItem = itemInformation.EquippedItem
local numberOfItems = #availableTools
local itemFrame = safeArea.ItemFrame
local shopButton = script.Parent:WaitForChild("ShopButton")
local buyButton = infoFrame.BuyButton
local equippedItemViewport = script.Parent:WaitForChild("EquippedItemViewport")
local itemViewport = itemInformation.ItemViewport
shopButton.MouseButton1Click:Connect(function()
mainFrame.Visible = not mainFrame.Visible
end)
local PADDING_X = 0.02
local DROPDOWN_Y = 0.2
local DROPDOWN_X = 0.25
local item1 = itemFrame:WaitForChild("Item1")
local box
local numRows = 1
for i = 1,numberOfItems,1 do
if i == 1 then
box = item1
else
box = item1:Clone()
box.Name = "Item"..i
box.Parent = itemFrame
if (i-1) / (4*numRows) == 1 then
-- New Row
numRows = numRows + 1
box.Position = UDim2.new(PADDING_X,0,box.Position.Y.Scale,0) + UDim2.new(0,0,DROPDOWN_Y*(numRows - 1))
else
-- Add to the X only
box.Position = itemFrame["Item"..(i-1)].Position + UDim2.new(DROPDOWN_X,0,0,0)
end
end
box.MouseButton1Click:Connect(function()
for _, v in pairs(itemViewport:GetChildren()) do
if not v:IsA("Frame") then
v:Destroy()
end
end
local itemViewportCam = Instance.new("Camera")
itemViewportCam.Parent = itemViewport
local handle = game.ReplicatedStorage:WaitForChild("ToolModels"):FindFirstChild(availableTools[i][1].."Handle"):Clone()
handle.Parent = itemViewport
itemViewport.CurrentCamera = itemViewportCam
itemViewportCam.CFrame = handle.CameraCFrame.Value
local owned = game.ReplicatedStorage.ItemCheck:InvokeServer(availableTools[i][1])
if equippedItem.Value == availableTools[i][1] then
infoFrame.Cash.Text = "Owned"
infoFrame.BuyButton.Text = "Unequip"
elseif owned == true then
infoFrame.Cash.Text = "Owned"
infoFrame.BuyButton.Text = "Equip"
else
infoFrame.BuyButton.Text = "Buy"
infoFrame.Cash.Text = "$"..availableTools[i][1]
end
infoFrame.ItemName.Text = availableTools[i][1]
selectedItem.Value = availableTools[i][1]
for _, v in pairs(itemFrame:GetChildren()) do
if v:IsA("ImageButton") then
v.BorderSizePixel = 0
end
end
itemFrame["Item"..i].BorderSizePixel = 2
end)
local fakeCam = Instance.new("Camera")
fakeCam.Parent = box.VPF
local handle = game.ReplicatedStorage:WaitForChild("ToolModels"):FindFirstChild(availableTools[i][1].."Handle"):Clone()
handle.Parent = box.VPF
box.VPF.CurrentCamera = fakeCam
fakeCam.CFrame = handle.CameraCFrame.Value
itemFrame["Item"..i].ItemName.Text = availableTools[i][1]
end
buyButton.MouseButton1Click:Connect(function()
local result = game.ReplicatedStorage.PurchaseItem:InvokeServer(selectedItem.Value)
if result == true then
buyButton.BackroundColor3 = Color3.fromRGB(42,149,42)
buyButton.Text = "Brought!"
wait(0.5)
buyButton.Text = "Equip"
buyButton.BackgroundColor3 = Color3.fromRGB(55,193,55)
elseif result == "NotEnoughBytes" then
buyButton.BackgroundColor3 = Color3.fromRGB(204,31,31)
buyButton.Text = "Not Enough Bytes!"
wait(0.5)
buyButton.Text = "Buy"
buyButton.BackgroundColor3 = Color3.fromRGB(55,193,55)
elseif result == "Equipped" then
equippedItem.Value = selectedItem.Value
buyButton.BackgroundColor3 = Color3.fromRGB(42,149,42)
buyButton.Text = "Equipped!"
wait(0.5)
buyButton.Text = "Unequip"
buyButton.BackgroundColor3 = Color3.fromRGB(55,193,55)
elseif result == "Unequipped!" then
equippedItem.Value = ""
buyButton.BackgroundColor3 = Color3.fromRGB(42,149,42)
buyButton.Text = "Unequipped!"
wait(0.5)
buyButton.Text = "Equip"
buyButton.BackgroundColor3 = Color3.fromRGB(55,193,55)
end
end)
The Main Script that has the " Bomb " Problem
-- Define Variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MapsFolder = ServerStorage:WaitForChild("Maps")
local Status = ReplicatedStorage:WaitForChild("Status")
local GameLength = 180
local reward = 25
-- Game Loop
while true do
Status.Value = "Waiting for enough players..."
repeat wait() until game.Players.NumPlayers >= 2
Status.Value = "Intermission..."
wait(25)
local plrs = {}
for i, player in pairs (game.Players:GetPlayers()) do
if player then
table.insert(plrs,player) -- Add each player into plrs table
end
end
wait(2)
local AvalibleMaps = MapsFolder:GetChildren()
local ChosenMap = AvalibleMaps[math.random(1,#AvalibleMaps)]
Status.Value = ChosenMap.Name.."Chosen"
local ClonedMap = ChosenMap:Clone()
ClonedMap.Parent = workspace
-- Telaports players to the map
local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")
if not SpawnPoints then
print(" { ERROR 101 } SpawnPoints not found!")
end
local AvalibleSpawnPoints = SpawnPoints:GetChildren()
for i, player in pairs(plrs) do
if player then
character= player.character
if character then
-- Telaport them
character:FindFirstChild("HumanoidRootPart").CFrame = AvalibleSpawnPoints[1].CFrame
table.remove(AvalibleSpawnPoints,1)
-- Give them a Sword!
local Sword = ServerStorage.Sword:Clone()
Sword.Parent = player.Backpack
-- Give them a Bomb!
local Bomb = ServerStorage.Bomb:Clone()
Bomb.Parent = player.Backpack
-- Give them a Slingshot!
local Slingshot = ServerStorage.Slingshot:Clone()
Slingshot.Parent = player.Backpack
-- Give them a RocketLauncher!
local RocketLauncher = ServerStorage.RocketLauncher:Clone()
RocketLauncher.Parent = player.Backpack
local GameTag = Instance.new("BoolValue")
GameTag.Name = "GameTag"
GameTag.Parent = player.Character
else
-- Their is no character
if not player then
table.remove(plrs, i)
end
end
end
end
Status.Value = "Get Ready To Play!"
wait(2)
for i = GameLength,0,-1 do
for x, player in pairs(plrs) do
if player then
character = player.Character
if not character then
-- Left the game
else
if character:FindFirstChild("GameTag") then
-- They are still alive
print(player.Name.." is still in the game!")
else
-- They are dead
table.remove(plrs,x)
print(player.Name.."Has been removed!")
end
end
else
table.remove(plrs,x)
print(player.Name.."Has been removed!")
end
end
Status.Value = "There are "..i.." seconds remaning, and "..#plrs.." remaning."
if #plrs == 1 then
-- Last person standing!
Status.Value = "The winner is "..plrs[1].Name
plrs[1].leaderstats.Bytes.Value = plrs[1].leaderstats.Bytes.Value + reward
break
elseif #plrs == 0 then
Status.Value = "Nobody won :("
break
elseif i == 0 then
Status.Value = "Times Up!"
break
end
wait(1)
end
print("End of game")
wait(2)
for i, player in pairs(game.Players:GetPlayers()) do
character = player.Character
if not character then
--Ignore them
else
if character:FindFirstChild("GameTag") then
character.GameTag:Destroy()
end
if player.Backpack:FindFirstChild("Sword") then
player.Backpack.Sword:Destroy()
end
if character:FindFirstChild("Sword") then
character.Sword:Destroy()
end
end
end
ClonedMap:Destroy()
Status.Value = "The Game has ended!"
end