Hi, I am making a game and ran into a werid scripting error, it makes no sense because its telling me that Value is not a vaild member of player, even though I don't have player.Value in there, I even tried removing value from it and it still said it, Here's part of the code

The localscript

local RE = game:GetService("ReplicatedStorage").BuyItem
local button = script.Parent
local price = script.Parent.Price
local player = script.Parent.Parent.Parent.Parent.Parent

button.MouseButton1Click:Connect(function()
	RE:FireServer(player, price)
end)

Part of the script (if player.leaderstats.Views.Value >= price.Value then is the part with the error)

game:GetService("ReplicatedStorage"):WaitForChild("BuyItem").OnServerEvent:Connect(function(player, price)
	if player.leaderstats.Views.Value >= price.Value then
		player.ViewsEveryClick.Value = player.ViewsEveryClick.Value + 5
		player.leaderstats.Views.Value = player.leaderstats.Views.Value - price.Value
	end
end)

Ok so I tried removing the if statement giving the error and I got the error somewhere else

8 comments

2

You can't pass objects to the server for security reasons. You are referencing price.Value, instead, expect 'price' to be a number and compare it that way.

0

So how would I fix it?

0

Send the value of it

0

The price is 25

0

?...

0

Instead of sending price sent the value of it

0

The value of what? There value of the price?

0

Yes