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

Why dosen't the value of the variable change?

Whats wrong is that the value of string dosen't change, price2 dosen't change value when clicked. Wheras price3.Text works, it might be because you can't change a variable with a variable idk.

local price = script.Parent.ItemPrice
local price2 = script.Parent.Parent.Parent.Parent.Info.Price
local price3 = script.Parent.Parent.Parent.Parent.Info.ItemPrice
local name = script.Parent.ItemName
local name2 = script.Parent.Parent.Parent.Parent.Info.ItemName
local image = script.Parent.ItemImage
local image2 = script.Parent.Parent.Parent.Parent.Info.ItemImage

script.Parent.MouseButton1Click:connect(function()
	-- This is the line of code that does not work
	price2.Value = price.Value
	-- code ends here
	price3.Text = price.Value
	name2.Value = name.Value
	image2.Image = image.Value
end)

5 comments

0

is price a intvalue or a string

0

it doesnt matter

0

is it a local or server?

0

Uhmm, why does price not have .Name or .Value or something describing it's value.

0

How do you know the value doesn't change? Where are you next checking it from?

1 answer

✓ Accepted answer

If this is in a LocalScript, changing price2.Value won't be replicated to the server, meaning changes will only be visible to other LocalScripts running on the same player.

If you need to change the value and have it replicate to the server, consider using a RemoteEvent.

1 comment

0

thx

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