Your error is telling you that the object you are trying to add to a string is undefined.
This could be item.Name
or price.Value
is undefined and causing this string construction to fail.
Looking at how you are defining item
and price
shows that both of these values are undefined in your LocalScript's callback. When you call a RemoteEvent's FireClient function, the first argument tells the engine who to send the event to, and all the other arguments get passed in as the arguments of the callback. Currently, you aren't passing in any arguments at all.
So to fix your problem, you need to pass in the right arguments from the Script:
game.ReplicatedStorage.ShopInfoEvent:FireClient(player, price, item)
and parse them properly in your LocalScript :
game.ReplicatedStorage.ShopInfoEvent.OnClientEvent:Connect(function(price, item)
script.Parent.Text = "Would you like to buy this ".. item.Name .." for ".. tostring(price.Value) .."?"
end)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…