Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

No title will work please read? [closed]

Asked by 3 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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)
0
What do you need help with? https://idownvotedbecau.se/unclear User#30567 0 — 3y
0
I need help with remote events overall Kittymuffin323 -10 — 3y
0
Like, do i put it all in one script or in two scripts like that? Kittymuffin323 -10 — 3y
0
Two scripts like that User#30567 0 — 3y
View all comments (2 more)
0
But for some reason it doesn't work, do you know why? Kittymuffin323 -10 — 3y
0
What do you mean "doesn't work"? http://xyproblem.info User#30567 0 — 3y

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?