Remote Event Won't Fire

I’m trying to make a complete rework of my game that I made last year called Candy Cane Simulator. This year for December I figured a complete game rework was needed due to a lot of stuff breaking and the confusing scripts. In CCS2, I am trying to make a quest giver. I have a system where it has a value inside a folder which is inside the player. The Value of the value determines which UI to pop up when you approach the Quest Giver. When you get to the last “page” of the first quest, it un-anchors you so you can move, removes the UI from your screen, and fires an event to change the value inside the player from “Quest1Starting” to “Quest1During”. Below are the two scripts(the one in the UI and the RemoteEvent scripts.) The first one is in the UI and the second one is in the remote event which is in a folder which is in ReplicatedStorage. I’d also like to note the script in the UI is a local script while the one in the event is just a normal script.
print(“1”) does appear in output while print(“2”) does not

script.Parent.Quest1Starting10.Continue.MouseButton1Down:Connect(function()
local plr = game.Players.LocalPlayer
local char = game.Workspace:FindFirstChild(plr.Name)
char.HumanoidRootPart.Anchored = false
rs.RemoteEvents.Quest1Starting:FireServer(plr)
print("1")
wait()
script.Parent:Destroy()
end)
--Second script
script.Parent.OnServerEvent:Connect(function(plr)

print("2")

plr.QuestValues.SantaQuest.Value = "Quest1During"

end)
1 Like

Couple of things first off:

  1. This is a super risky way of getting a character, consider a player called ‘Baseplate’ and you’ll realise why. Try plr.Character instead.
local char = game.Workspace:FindFirstChild(plr.Name)
  1. Please, please, PLEASE indent your code, it makes it so much easier to read and understand what’s happening. Here’s what your code should look like:
script.Parent.Quest1Starting10.Continue.MouseButton1Down:Connect(function()
	local plr = game.Players.LocalPlayer
	local char = game.Workspace:FindFirstChild(plr.Name)
	char.HumanoidRootPart.Anchored = false
	rs.RemoteEvents.Quest1Starting:FireServer(plr)
	print("1")
	wait()
	script.Parent:Destroy()
end)
script.Parent.OnServerEvent:Connect(function(plr)
	print(“2”)
	plr.QuestValues.SantaQuest.Value = “Quest1During”
end)

This is definitely not how I would do what you’re doing, but I’ll try and help you figure out the problem anyway. Please include in your post, whether the print("1") is being shown in the output on the local side. Is the print("2") being outputted on the server? How do you know that the RemoteEvent is not firing? Remember people are taking time out of their day to help you fix your problem, make sure it’s as easy to understand as possible! :slight_smile:

Edit: I didn’t realise from your post that the Script is in RepStorage, as @idkhowtocode said, scripts wont run there. Move it to ServerScriptService and change your Remote references accordingly.

1 Like

The server script handling the remote event won’t run in replicated storage. Try moving the script only to ServerScriptService.

5 Likes