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

Why won't my Remote Event Fire?

I have two script. One for firing the remote event and one for receiving. I have a remote event in ReplicatedStorage. I also have a script in ReplicatedStorage. The remote vent is not being fired for some reason. Please help. TIA for any help. BTW I can't click on the code button because if I move my mouse, StackEdits will close out

Script in Replicated... local ReplicatedStorage = game:GetService('ReplicatedStorage')

remote = game.ReplicatedStorage.QueEvent

remote.OnServerEvent:Connect(function(plr, num)

print(plr.Name)

print(num)

if num == 0 then

script.Parent.Que.Value = 0

else

script.Parent.Que.Value = script.Parent.Que.Value + num

end

end)

LocalScript inside a button in a players Gui local ReplicatedStorage = game:GetService('ReplicatedStorage')

remote = game.ReplicatedStorage.QueEvent

script.parent.MouseButton1Click:Connect(function()

if game.Players.LocalPlayer.Playing.Value == false then

game.Players.LocalPlayer.Playing.Value = true

script.Parent.Text = 'UnReadyUp'

script.Parent.Parent.QueLabel.TextTransparency = 0

script.Parent.Parent.QueLabel.BackgroundTransparency = 0

remote:FireServer(1)

print('+1')

else

game.Players.LocalPlayer.Playing.Value = false

script.Parent.Text = 'ReadyUp'

script.Parent.Parent.QueLabel.TextTransparency = 1

script.Parent.Parent.QueLabel.BackgroundTransparency = 1

remote:FireServer(-1)

print('-1')

end

end)

3 comments

0

Are there any errors in the output? also use WaitForChild when searching the remoteevent inside the replicatedstorage on both script.

0

Ok, also no, no erros

0

WaitForChild didn't fix the problem

1 answer

One thing I see is that the path to your RemoteEvent isn't correct. You have:

local ReplicatedStorage = game:GetService(‘ReplicatedStorage’)
remote = game.ReplicatedStorage.QueEvent

Which ends up making remote equal to game.game.ReplicatedStorage.QueEvent

Instead leave out the game. in the remote assignment and make it just local remote = ReplicatedStorage.QueEvent Also, the variable for your replicated storage might get confused. I'd try to play it safe by naming it something else like repStorage.

local repStorage = game:GetService('ReplicatedStorage')
local remote = repStorage.QueEvent

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