#InvokeServer Error
11 messages · Page 1 of 1 (latest)
Please wait while I post the script
This is the leaderstat script vvvvvv
local leaderstats = Instance.new("Folder", plr)
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue",leaderstats)
coins.Name = "Coins"
coins.Value = 50
end)
local Prices = {
sword = 30,
gun = 60,
magicwand = 20,
shield = 30
}
local PurchaseButtonRemote = game.ReplicatedStorage.PurchaseButtonRemote
PurchaseButtonRemote.OnServerInvoke = function(plr, item)
local PurchaseSuccess = false
local leaderstat = plr.leaderstats
local Coins = leaderstat.Coins
if Coins.Value >= Prices[item] then
Coins.Value -= Prices[item]
PurchaseSuccess = true
end
return PurchaseSuccess
end```
local gui = script.Parent
local SwordButton = gui.Sword
local MagicwandButton = gui.MagicWand
local ShieldButton = gui.Shield
local GunButton = gui.Gun
local PurchaseButtonRemote = game.ReplicatedStorage.PurchaseButtonRemote
SwordButton.MouseButton1Click:Connect(function()
local PurchaseSuccess = SwordButton:InvokeServer("sword")
print(PurchaseSuccess)
end)
This is the button script that I was testing
This is the error I get when I press the button
SwordButton
is a guibutton, not a remotefunction
Oh bruh I feel stupid now
thanks
** You are now Level 4! **