Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Scripting Error that makes no sense, can someone help? [closed]

Asked by 4 years ago
Edited 4 years ago

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

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. pidgey 548 — 4y
0
So how would I fix it? User#28794 0 — 4y
0
Send the value of it Creacoz 210 — 4y
0
The price is 25 User#28794 0 — 4y
View all comments (4 more)
0
?... Creacoz 210 — 4y
0
Instead of sending price sent the value of it Creacoz 210 — 4y
0
The value of what? There value of the price? User#28794 0 — 4y
0
Yes Creacoz 210 — 4y

Closed as Non-Descriptive by Mr_Unlucky, SuperSamyGamer, and Leamir

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?