Currently, I have a local script in place where if you click a GUI Button, it fires a server event. Then, a server script inside ServerScriptService is supposed to receive it. As the script stands right now, nothing happens when it's surrounded by other functions like this:
local event = game:GetService("ReplicatedStorage"):WaitForChild("Effect")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
event.OnServerEvent:Connect(function(player, effect)
print("test")
end)
end)
end)?
However, it works perfectly fine when not inside the functions, like so:
local event = game:GetService("ReplicatedStorage"):WaitForChild("Effect")
event.OnServerEvent:Connect(function(effect)
print("test")
end)
And given this script will attach a brick onto the player's torso, it'll need to find the player. But I'm not sure what about the functions seem to cancel out the server event. Any ideas?

3 comments
why the question mark on line 10
and the "end)" on line 8 is out of place for the first script
Whoops, the question mark is a typo. It's not actually in the script, though. And repositioning the "end)" didnt do anything.