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

Why won't my Remote Event Fire?

Asked by
sheepposu 561 Moderation Voter
5 years ago

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)

0
Are there any errors in the output? also use WaitForChild when searching the remoteevent inside the replicatedstorage on both script. MArzalAlBuchariZ 33 — 5y
0
Ok, also no, no erros sheepposu 561 — 5y
0
WaitForChild didn't fix the problem sheepposu 561 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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
Ad

Answer this question