Greetings,
I've got an error while scripting the server side of my gun shop, this is the server script:
--[[
By Time_URSS
Server-sided Gun shop
--]]
--//Variables\\--
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteFunction = replicatedStorage:WaitForChild("Buy")
--//Functions\\--
remoteFunction.OnServerEvent:Connect(function(player,price,gun)
player.leaderstats.Rubbles.Value = player.leaderstats.Rubbles.Value - price.Value
local clonedGun = gun:Clone()
clonedGun.Parent = player.Backpack
print("Gun successfully bought, transaction successful.")
end)
This is the client sided script:
--[[
Script made by: Time_URSS
Client-sided gun shop
--]]
--//Variables\\--
local player = game.Players.LocalPlayer
local button = script.Parent
local name = button:WaitForChild("FinalName")
local price = button:WaitForChild("FinalPrice")
local nameText = button.Parent.Name
local priceText = button.Parent.Price
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteFunction = replicatedStorage:WaitForChild("Buy")
--//Functions\\--
local function buyProcess()
local weapon = replicatedStorage:WaitForChild("Guns"):FindFirstChild(name.Value)
if weapon then
if player.leaderstats.Rubbles.Value >= price.Value then
remoteFunction:FireServer(player,price.Value,weapon)
else
warn("Player does not have enough Rubbles to buy the gun. Wait until you've enough.")
end
else
error("Weapon not found, please contact Time_URSS to fix the error. ERROR#050")
end
end
button.MouseButton1Click:Connect(buyProcess)
And this is the error:
11:59:47.653 - Value is not a valid member of Player
11:59:47.655 - Stack Begin
11:59:47.656 - Script 'ServerScriptService.BuyProcess', Line 12
11:59:47.656 - Stack End
Can somebody help me?

1 comment
I see, thank you!