I've always had problems with remote events, but now I'm really not sure what I did wrong.
Local script in the GUI
script.Parent.ChildAdded:Connect(function(tag) if tag:IsA("TextButton") then tag.MouseButton1Click:Connect(function() print("Clicked") game.ReplicatedStorage:WaitForChild("ChangeStage"):FireServer() end) end end)
Server Script in ServerScriptService
game.ReplicatedStorage:WaitForChild("ChangeStage").OnServerEvent:Connect(function(player) print("Event Received") end)
Remote Event called "ChangeStage" is in Replicated Storage. Again, it runs fine in Local Play, which doesn't make much sense to me because I don't know what about the FilteringEnabled is preventing the event from reaching the server while testing.
Your code errors:
script.Parent.ChildAdded:Connect(function(child) if child:IsA("TextButton") then -- You're not only returning a textbutton. You're returning anything that inherits from it. child.MouseButton1Click:Connect(function() -- nope end) -- end) inside of an end? end-- Big no no end)
No errors
cript.Parent.ChildAdded:Connect(function(child) if child.ClassName == "TextButton" then -- You're returning a textbutton. For a fact. child.MouseButton1Click:Wait() -- yup end -- Look at that. end)