This code fires the remote when you touch a part: (Server script)
script.Parent.Touched:connect(function(hit) game.ReplicatedStorage.Remotes.FeedTheBeliever:FireClient(hit) end)
This code is what happens when you fire the remote: (Local script)
eat = game.ReplicatedStorage.Remotes.FeedTheBeliever eat.OnClientEvent:connect(function(hit) print(hit.Name) end)
No errors, and I don't know why this is going on. I tried looking in the wiki, but that was no help. Any suggestions?
This is similar to what litelmpulse answered. The only thing he got wrong was that you're supposed to send the player, not the character, as the argument.
So, here is the serverscript:
script.Parent.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) game:GetService("ReplicatedStorage").RemoteEvent:FireClient(player, hit) end)
Server Side
script.Parent.Touched:Connect(function(hit) local player = hit.Parent game:GetService("ReplicatedStorage").RemoteEvent:FireClient(player, hit) end)
Client Side
game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function(hit) print(hit.Name) end)