Number Value not Changing

I’m a bit new to scripting, could somebody help?

I’d like to use a number value, and when you click a block, it fires a remote event to a script that changes the number value. And when the number value changes, the value is a clothing ID, for a mannequin, if that makes sense. I’m trying to make a mannequin, when you click on it, it opens a gui, and in that gui you can buy clothing.

I’m not sure if the remote event isn’t sending through or something, but the number value isn’t changing.

I’ve looked for solutions on here already, but I haven’t seen anything that applies to what i’m trying to do.

`script.Parent.ClickDetector.MouseClick:Connect(function(player)
	game.ReplicatedStorage.MannequinEvents.Mannequin2:FireServer(player)
end)` --This fires my event to change the number value. (LocalScript)

`game.ReplicatedStorage.MannequinEvents.Mannequin2.OnServerEvent:Connect(function()
	script.Parent.Template.ShirtBuy.TopID.Value = 6025963973
	script.Parent.Template.PantsBuy.BottomsID.Value = 6025967112
end)` --This is supposed to change the value. (ServerScript)

If there is careless mistakes please be patient

I don’t think this is problem but you don’t need to send player instance
Player instances will be sent automatically, Also server code doesn’t even read the player argument

1 Like

Local scripts do not run in workspace, so you can’t use this. Also, the player who is being fired to the server is always the first argument, so you don’t need to worry about that.

Where is your server script located? I don’t think you will need events to change this

Wait, I can’t use local scripts in workspace? I thought it was only when it wasn’t in a model or something

Also I don’t have any other server scripts unless you’re referring to the one that fires the events.

`script.Parent.ClickDetector.MouseClick:Connect(function(player)
	game.ReplicatedStorage.MannequinEvents.Mannequin2:FireClient(player)
end)` --This fires my event to open the GUI in my mannequin.

`game.ReplicatedStorage.MannequinEvents.Mannequin2.OnClientEvent:Connect(function()
script.Parent.Visible = true
script.Parent.Template.ClothingImage.Image = ("https://www.roblox.com/asset-thumbnail/image?assetId=6397010834&width=420&height=420&format=png")
script.Parent.Template.CDesigner.Text = "Designed by mixinae"
script.Parent.Template.CUploader.Text = "Uploaded by mixinae"
script.Parent.Template.CDescription.Text = "Navy blue bow, sailor collar, sleeves, and pockets! Along with a white dress under it."
script.Parent.Template.CName.Text = "Darling Navy | ORIGINAL"
script.Parent.Template.CPrice.Text = "5 Robux"
script.Parent.Template.Buy2Button.Text = "BUY PANTS"
end)` --This is in a Local Script

Before I tried to add changing the number value there (since I only need it to change on the client side), but It didn’t change at all.

LocalScripts only run in workspace if they’re part of the player’s character model

1 Like

Also the first script is in workspace (it’s a normal script)
The second script is in a GUI,( its a local script )

	script.Parent.Template.PantsBuy.BottomsID.Value = 6397010834
	script.Parent.Template.ShirtBuy.TopID.Value = 6397010834
end)

When I add this to the bottom of it, nothing changes. In output, it says “MarketplaceService:PromptPurchase() second argument is not a valid assetId (supplied assetId was less than 0)” because yea, it didn’t change.

I fixed it, by deleting the number value I was using and changing it to an IntValue.

Thank you for those who tried to help!