PLEASE READ: My code won't get past the 24th line
This is in a local script in starter gui
my script:
--Variables--
local Button = script.Parent
local Player = game:GetService("Players").LocalPlayer
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
local PurchaseButton = script.Parent.BuyPrompt.PurchaseButton
local LeaveButton = script.Parent.BuyPrompt.LeaveButton
--Actual scripting--
script.Parent.MouseButton1Down:Connect(function()
script.Parent.BuyPrompt.Visible = true
end)
LeaveButton.MouseButton1Down:Connect(function()
script.Parent.BuyPrompt.Visible = false
end)
PurchaseButton.MouseButton1Down:Connect(function()
RemoteEvent:FireServer("FourthGun")
end)
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
local Item = game:GetService("ServerStorage").Guns.FourthGun
RemoteEvent.OnServerEvent:Connect(function(Player, item)
if item == Item.Name then
local Cash = Player.leaderstats.Cash
if Cash.Value >= 50 then
Cash.Value = Cash.Value - 50
Item = Item:Clone()
Item.Parent = Player.Backpack
else
print("Not enough cash")
end
end
end)

2 comments
Yeah, I had this issue before. I don't know why it doesn't work.
What can I do then?