local player = game.Players.LocalPlayer local currency = player:WaitForChild('leaderstats').Points local amount = 5 local tool = game.ServerStorage:WaitForChild('Firebrand') script.Parent.MouseButton1Click:connect(function() if currency.Value >= amount and not player.Backpack:FindFirstChild("Firebrand")or player.Character:FindFirstChild('Firebrand') then -- They Dont Have it local newtool = tool:Clone() newtool.Parent = player.Backpack else script.Parent.Text = 'Purchase Failed' end end)
ServerStorage
is exactly that -- storage for the server -- not the client. LocalScripts do not have access to anything in ServerStorage -- ROBLOX won't bother sending them those files.
If you want to make a model available to clients (i.e., LocalScripts) you have to use ReplicatedStorage
.
Also, your order-of-operations is wrong with or
, and
, and not
.
if a and not b or c
is interpreted as if (a and (not b)) or c then
. Thus the purchase will go through if they have it in their character, even if they don't have enough money.