so can someone tell me whats wrong with this, its a script that is supposed to send a request to the server to check the players gold to see if its high enough to buy the armor, and if it is, then it clones it, if not, it should do nothing
--Server:
local players = game:GetService("Players")
local rs = game:GetService("ReplicatedStorage")
local blackevent = rs.armors.ArmorEvents:WaitForChild("BlackEvent")
local goldevent = rs.armors.ArmorEvents:WaitForChild("GoldEVENT")
local regevent = rs.armors.ArmorEvents:WaitForChild("RegEvent")
function onBlackInvoke(plr)
print("epic")
if plr.leaderstats.Gold.Value < 1500 then
print("epic")
return false
elseif plr.leaderstats.Gold.Value >= 1500 then
print("epic")
plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value - 1500
return true
end
end
function onGoldInvoke(plr)
print("epic")
if plr.leaderstats.Gold.Value < 1000 then
print("epic")
return false
elseif plr.leaderstats.Gold.Value >= 1000 then
print("epic")
plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value - 1000
return true
end
end
function onRegInvoke(plr)
print("epic")
if plr.leaderstats.Gold.Value < 500 then
print("epic")
return false
elseif plr.leaderstats.Gold.Value >= 500 then
print("epic")
plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value - 500
return true
end
end
blackevent.OnServerInvoke = onBlackInvoke()
goldevent.OnServerInvoke = onGoldInvoke()
regevent.OnServerInvoke = onRegInvoke()
-- Client:
interface.ScrollingFrame.BlackBuy.Activated:connect(function()
if blackevent:InvokeServer() == true then
rs.armors["Dark Armor (+250"]:Clone().Parent = client.Backpack
elseif
blackevent:InvokeServer() == false then
return
end
end)
interface.ScrollingFrame.GoldBuy.Activated:connect(function()
if goldevent:InvokeServer() == true then
rs.armors["Golden Armor (+150)"]:Clone().Parent = client.Backpack
elseif goldevent:InvokeServer() == false then
return
end
end)
interface.ScrollFrame.RegBuy.Activated:connect(function()
if regevent:InvokeServer() == true then
rs.armors["Armor (+75)"]:Clone().Parent = client.Backpack
elseif regevent:InvokeServer() == false then
return
end
end)
-- Not all of client script, but the part where its used.

1 comment
For the server script, try taking "()" away from line 40 - 43, also, In the future try experimenting with tables rather that copy and pasting the same code for different items. They are very helpful.