Whenever You Click The Button this errors appears and I'm not sure why? If I take away the .Value it doesn't change the Value to False?
Local Script In Button
local Owned = require(game.ReplicatedStorage.OwnedEvents.Ownership)
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local price = script.Parent.Price.Value
game:GetService("ReplicatedStorage")
if Owned.Owned1.Value == false then
game.ReplicatedStorage.GetPrice:InvokeServer(price)
elseif Owned.Owned1.Value == true then
script.Parent.Text = "Already Purchased!"
wait(1)
script.Parent.Text = "BUY TEST 1"
end
end)
Module
local OwnedEvents = {
["Owned1"] = false,
["Owned2"] = false,
}
return OwnedEvents
ServerScript
local Items = require(game.ReplicatedStorage.Shop.Shop)
local Owned = require(game.ReplicatedStorage.OwnedEvents.Ownership)
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder",plr)
leaderstats.Name = "leaderstats"
local Coins = Instance.new("IntValue",leaderstats)
Coins.Name = "Coins"
Coins.Value = 0
end)
game.ReplicatedStorage.GetPrice.OnServerInvoke = function(player, price)
print(price)
if price == 15 then
print("Purchase Completed")
Owned.Owned1 = true
print(Owned.Owned1)
return true
elseif Owned.Owned1.Value == true then
return false
end
end
