-
What do you want to achieve? I want my images be blacked out and the name and image of tools should come
-
What is the issue? it doesnt work
-
What solutions have you tried so far? i tried using other methods but they came with error but doesnt have errors
--part 1/2
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local templateno = tonumber(script.Parent.Parent.Name)
local templatename = script.Parent.Parent.ToolName.Value
local previousno
local previousname
if templateno ~=1 then
previousno = templateno -1
previousname = script.Parent.Parent.Parent:FindFirstChild(previousno).ToolName.Value
else
previousname = script.Parent.Parent.ToolName.Value
end
if player.OwnedItems:FindFirstChild(previousname) then
local sidemenu = script.Parent.Parent.Parent.Parent.Parent.SideMenu
sidemenu.ImageOftool.Image = script.Parent.Parent.ToolImageDisp.ImageLabel.Image
sidemenu.ImageOftool.ImageColor3 = Color3.fromRGB(255,255,255)
sidemenu.NameOftool.TextLabel.Text = script.Parent.Parent.ToolName.Value
sidemenu.Cost.CostOfTool.Value = script.Parent.Parent.CostDisplay.Value
sidemenu.Cost.CostDisplayer.Text = "Cost : "..sidemenu.Cost.CostOfTool.Value
if player.Equipped.Value == script.Parent.Parent.ToolName.Value then
sidemenu.BuyButton.TextButton.Text = "Equipped"
elseif player.OwnedItems:FindFirstChild(templatename) then
sidemenu.BuyButton.TextButton.Text = "Equip"
else
sidemenu.BuyButton.TextButton.Text = "Buy"
end
else
local sidemenu = script.Parent.Parent.Parent.Parent.Parent.SideMenu
sidemenu.ImageOftool.Image = script.Parent.Parent.ToolImageDisp.ImageLabel.Image
sidemenu.ImageOftool.ImageColor3 = Color3.fromRGB(0,0,0)
sidemenu.NameOftool.TextLabel.Text = "???"
sidemenu.Cost.CostOfTool.Value = 0
sidemenu.Cost.CostDisplayer.Text = "Cost : ???"
sidemenu.BuyButton.TextButton.Text = "Can't Buy Now"
end
end)
--oart 2/2
game.ReplicatedStorage.Remotes.PlayerLoaded:FireServer()
print("PlayerLoaded")
local player = game.Players.LocalPlayer
local number = 1
local strings = tostring(number)
game.ReplicatedStorage.Remotes.BeginArrangement.OnClientEvent:Connect(function()
print("Got")
repeat
local image = game:GetService("ReplicatedStorage").ToolsImage:WaitForChild(strings)
if image:IsA("ImageLabel") then
print(image.Name)
local clone = game.ReplicatedStorage.Template:Clone()
clone.ToolImageDisp.ImageLabel.Image = image.Image
clone.Name = image.Name
clone.CostDisplay.Value = image.Cost.Value
clone.ToolName.Value = image.ToolName.Value
clone.Parent = script.Parent
clone.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(0,0,0)
if clone.Name == "1" then
local sidemenu = script.Parent.Parent
sidemenu.tool_img.Image = image.Image
sidemenu.tool_img.ImageColor3 = Color3.fromRGB(255,255,255)
sidemenu.status.Text = "Equip"
sidemenu.price.cost.Value = 0
sidemenu.price.Text = "Cost : 0"
sidemenu.name.Text = clone.ToolName.Value
end
if player.OwnedItems:FindFirstChild(clone.ToolName.Value) then
clone.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(255,255,255)
end
local equipped = player:WaitForChild("Equipped")
if equipped.Value~= nil then
if clone.ToolName.Value == equipped.Value then
script.Parent.tool_img.Image = image.Image
script.Parent.tool_img.ImageColor3 = Color3.fromRGB(255,255,255)
script.Parent.ststus.TextButton.Text = "Equipped"
script.Parent.price.Cost.Value = clone.CostDisplay.Value
script.Parent.price.Text = "Cost : "..script.Parent.price.cost.Value
script.Parent.name.Text = clone.ToolName.Value
game.ReplicatedStorage.Remotes.EquipTool:FireServer(equipped.Value)
end
end
local number = tonumber(clone.Name)
if number ~= 1 then
local previousnum = number-1
local itemfound = script.Parent:FindFirstChild(previousnum)
if itemfound then
if player.OwnedItems:FindFirstChild(itemfound.ToolName.Value) then
clone.ToolImageDisp.ImageLabel.ImageColor3 = Color3.fromRGB(255,255,255)
end
end
end
end
number = number+1
until number == game.ReplicatedStorage.TotalTools.Value + 1
end)