Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 comment

0

put a print before the event firing on the client

1 answer

✓ Accepted answer
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)

1 comment

0

Doesn't seem to work

This discussion is preserved as it was. New answers, comments, and votes are closed.