Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why wont my pricing wont show in the shop ui???

I am makeing a shop and the ui will not show the price I have the code and have not found any issues

local plr = game.Players.LocalPlayer
local CurrentCamera = game.Workspace.Camera

local CurrentItem = 1
local Items = 12

local Next = script.Parent.Next
local Previous = script.Parent.Previous
local Close = script.Parent.Close

local Equip = script.Parent.Button

local db = false

game.ReplicatedStorage.RemoteEvents.Shop.OnClientEvent:Connect(function()
	if script.Parent.Visible == false and db == false then
		db = true
		script.Parent.Visible = true
		script.Parent.Parent.Main.Visible = false
		script.Parent.Parent.TwitterCode.Visible = false
		local Item = game.Workspace.Items[CurrentItem]
		CurrentCamera.CameraType = Enum.CameraType.Scriptable
		CurrentCamera.CameraSubject = Item.Camera
		CurrentCamera.CFrame = Item.Camera.CFrame
		script.Parent.Item.Text = Item.Configure.Item.Value
		game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
		game.Players.LocalPlayer.Character.Humanoid:UnequipTools()
		if plr.Items:FindFirstChild(Item.Configure.Item.Value) then
			script.Parent.Button.TextLabel.Text = "Equip"
		else
			script.Parent.Button.TextLabel.Text = Item.Configure.Price.Value
		end
	end
end)

Next.MouseButton1Click:Connect(function()
	CurrentItem = CurrentItem + 1
	if CurrentItem > Items then
		CurrentItem = 1
	end
	script.Parent.Parent.ClickEffect:Play()
	local Item = game.Workspace.Items[CurrentItem]
	CurrentCamera.CameraType = Enum.CameraType.Scriptable
	CurrentCamera.CameraSubject = Item.Camera
	CurrentCamera.CFrame = Item.Camera.CFrame
	script.Parent.Item.Text = Item.Configure.Item.Value
	if plr.Items:FindFirstChild(Item.Configure.Item.Value) then
		script.Parent.Button.TextLabel.Text = "Equip"
	else
		script.Parent.Button.TextLabel.Text = Item.Configure.Price.Value
	end
end)

Previous.MouseButton1Click:Connect(function()
	CurrentItem = CurrentItem - 1
	if CurrentItem < 1 then
		CurrentItem = Items
	end
	script.Parent.Parent.ClickEffect:Play()
	local Item = game.Workspace.Items[CurrentItem]
	CurrentCamera.CameraType = Enum.CameraType.Scriptable
	CurrentCamera.CameraSubject = Item.Camera
	CurrentCamera.CFrame = Item.Camera.CFrame
	script.Parent.Item.Text = Item.Configure.Item.Value
	if plr.Items:FindFirstChild(Item.Configure.Item.Value) then
		script.Parent.Button.TextLabel.Text = "Equip"
	else
		script.Parent.Button.TextLabel.Text = Item.Configure.Price.Value
	end
end)

Close.MouseButton1Click:Connect(function()
	script.Parent.Parent.ClickEffect:Play()
	CurrentCamera.CameraType = Enum.CameraType.Custom
	CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
	CurrentCamera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
	script.Parent.Parent.Main.Visible = true
	script.Parent.Parent.TwitterCode.Visible = true
	script.Parent.Visible = false
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
	wait(2)
	db = false
end)

Equip.MouseButton1Click:Connect(function()
	if script.Parent.Button.TextLabel.Text == "Equip" then
		script.Parent.Parent.ClickEffect:Play()
		game.ReplicatedStorage.RemoteEvents.EquipItem:FireServer(game.Workspace.Items[CurrentItem])
		CurrentCamera.CameraType = Enum.CameraType.Custom
		CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
		CurrentCamera.CFrame = game.Players.LocalPlayer.Character.Head.CFrame
		script.Parent.Parent.Main.Visible = true
		script.Parent.Parent.TwitterCode.Visible = true
		script.Parent.Visible = false
		game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
		wait(2)
		db = false
	else
		script.Parent.Parent.ClickEffect:Play()
		game.ReplicatedStorage.RemoteEvents.Buy:FireServer(game.Workspace.Items[CurrentItem])
	end
end)

game.ReplicatedStorage.RemoteEvents.Buy.OnClientEvent:Connect(function(ItemBought)
	local Item = game.Workspace.Items[CurrentItem]
	if Item.Configure.Item.Value == ItemBought then
		script.Parent.Button.TextLabel.Text = "Equip"
	end
end)

3 comments

0

Sidenote: Don't try and reinvent the wheel, if you want a "multi-page" window you can use UIPageLayout. The whole part of Next and Previous, having to render the right page and everything will be unnecessary. Additionally make sure your debounce (db) is properly set everywhere. Normally a debounce is used to keep 1 event from being spammed too often, with buttons this is often not a huge deal.

0

Additionally you can use the debugger to see if the line where you set the price to the textlabel is actually reached, if not you can work your way back from there

0

how tf do I use the debugger

1 answer

try putting this in all your things you want the text goes in price = game.Players.LocalPlayer.leaderstats.price.Value -- what ever you want price to be script.parent.text = "(itemOfyourchoice)Costs: "..price price.Value.change:connect(function() script.parent.text = "(itemOfyourchoice)Costs: "..price end)

2 comments

0

Don't make up random stuff, leaderstats isn't even involved at all

0

I just want it to be where it just says the value from a number value and the number text label is universal so it changes depending on the object

This discussion is preserved as it was. New answers, comments, and votes are closed.