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

Remote doesn't fire?, Debugged as much as I could, No errors

Asked by
0_2k 496 Moderation Voter
4 years ago
Edited 4 years ago

So every remote ( Can't check beyond the 13th line ), Works as of now. For some reason it wont fire, and it does print

local player = game.Players.LocalPlayer
local y
local name

game.ReplicatedStorage.Remotes:WaitForChild("onTouch").OnClientEvent:Connect(function(desc, cost, door)
    script.Parent.Visible = true
    script.Parent.Desc.Text = desc
    y = cost
    name = door
end)

script.Parent.Yes.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.Remotes:WaitForChild("Purchase"):FireServer(y, name)
    print(y) -- The amount prints
    print(name) -- The name of the door I want to delete posted
    script.Parent.Visible = false
    print("Yes button pressed")
end)

script.Parent.No.MouseButton1Down:Connect(function()
    script.Parent.Visible = false
end)

game:GetService("ReplicatedStorage").Remotes:WaitForChild("areaHandler").OnClientEvent:Connect(function(door)
    print("Area handler received")
    print(door)
    local i = workspace.Earth.Biomes.BiomeDoors[door]
    i:Destroy()
end)

Here's where nothing happens, Between the remote firing, and it not received the OnServerEvent function

local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
--local woodsAmount = 25000

game:GetService("ReplicatedStorage").Remotes.Purchase.OnServerEvent:Connect(function(player, cost, door)
    print("Received the purchase remote firing")
    local coinsDataStore = myDataStore:GetAsync(player.UserId.."-Coins")

    if player.leaderstats["Coins"].Value >= cost then
        player.leaderstats["Coins"].Value = player.leaderstats["Coins"].Value - cost
        myDataStore:SetAsync(player.UserId.."-Coins", player.leaderstats["Coins"].Value)
        print("Enough to purchase door and fired areahandler")

        game.ReplicatedStorage.Remotes.areaHandler:FireClient(player, door)
    else
        warn("Not enough and areahandler did NOT fire")
    end
end)

I have no clue if it's the remote or not, But it doesn't print "Received the purchase remote firing" I've tried a different remote, Different button functions, etc.. But the remote just wont fire. Yes the top script is a LocalScript in the gui, and the one below is a Server Script

0
put a print before the event firing on the client The_Pr0fessor 595 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
game.ReplicatedStorage.Remotes:WaitForChild("Purchase"):FireServer(y, name)

You have to initialize before you fire.

Try:

local remote = game.ReplicatedStorage.Remotes:WaitForChild("Purchase")
remote:FireServer(y, name)
0
Doesn't seem to work 0_2k 496 — 4y
Ad

Answer this question