Help me fix my shop, its not working

you’re supposed to delete the .value in the brackets, not the .value outside. because you are trying to waitforchild for the stringvalue, with the .value to mention the value property of said stringvalue

1 Like

but when i delete the value in the brackets, the script doesent run at all

1 Like

then its probably an issue with the remainder of your script.

1 Like

the localscript should works, i know because the bought massage i put is printed, so is the problem in the serverscript?

1 Like

Try printing all the variables in the serverscript to see what isn’t working.

1 Like

it doesent print anything in all of the variables

1 Like

Can you show me the code where you printed the variables?

1 Like

does CurrentShown have anything in the Value?

1 Like
local price = script.Parent.Parent.Parent.CPrice
local chosen = script.Parent.Parent.Parent.CurrentShown

game.ReplicatedStorage.BuyEvents.BoughtWCoins.OnServerEvent:Connect(function(player)
	
	local folder = player:WaitForChild("SwordStatus")
	local sword = folder:WaitForChild(tostring(chosen.Value))
	local coins = player.Coins
	
	print(price)
	print(chosen)
	print(folder)
	print(sword)
	print(coins)
	
	coins.Value -= price.Value
	sword = true
	
end)

1 Like

wht do you mean? i didnt understand your question.

1 Like

is the Value property of the Instance CurrentShown (or as seen in the script)

defined? because if CurrentShown.Value is blank, then tostring(chosen.Value) (or as shown in the script)

will return a blank text and it will wait for a child named “” which doesn’t exist and will wait forever, as seen in the console

Thats the thing i wondered, it worked on the localscript, put doesent in the serverscript

1 Like


Do you tried to change WaitForChild to FindFirstChild?

1 Like

what script is CurrentShown.Value being changed at? if you changed anything from the server, it will replicate to all clients but changing in the client doesn’t replicate to the server and other clients without using RemoteEvents

it’s best you check this out

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.