I'm currently making a gun shop for my zombie game, but I've run into an issue.
I don't have any experience in remote events, so I was wondering if someone could help me.
This normal script is in ServerScriptService
--Variables-- local Button = script.Parent local Player = game:GetService("Players").LocalPlayer local RemoteEvent = game:GetService("ReplicatedStorage").BuyRemoteEvent local PurchaseButton = script.Parent.BuyPrompt.PurchaseButton local LeaveButton = script.Parent.BuyPrompt.LeaveButton --Actual Scripting-- local RemoteEvent = game:GetService("ReplicatedStorage").BuyRemoteEvent 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)
This local Script is somewhere deep in StarterGUI
--Variables-- local Button = script.Parent local Player = game:GetService("Players").LocalPlayer local RemoteEvent = game:GetService("ReplicatedStorage").BuyRemoteEvent 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)
Closed as Non-Descriptive by Leamir
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?