First of all, it appears (from the snippit of code you supplied) that you aren’t waiting for the RemoteEvent to be added to ReplicatedStorage before trying to use :FireServer, and it also seems like you are trying to use RemoteFunctions through RemoteEvent functions/properties.
For RemoteFunctions, you need to use things like this:
RemoteFunction:InvokeServer()
RemoteFunction.OnServerInvoke = function()
end
You also are trying to create a new instance of “game.ReplicatedStorage.PetRemote” but that won’t work, you need to use something like:
I’ll also say you should NOT have the script in storage named to “PetRemote”, instead change it to something generic like “Script” so that it doesn’t interfere with other scripts trying to identify the remote.
The script in ReplicatedStorage, which I assume is called “PetRemote” (which would explain the error you got), should be located in ServerScriptService. You could also just insert a RemoteEvent into ReplicatedStorage manually which would also work.
Another reason why it would not work is that in your code, you wrote:
local Event = Instance.new(game.ReplicatedStorage.PetRemote)
which should have been:
local Event = Instance.new("RemoteEvent")
Event.Parent = game.ReplicatedStorage
Also, would appreciate it if you could mark my post as solution if it worked
Localscripts don’t have access to anything inside ServerScriptService, that’s why it says its not a valid member of ServerScriptService. Also, you are treating scripts as if they are RemoteFunctions, that’s why you were getting that error before.
Move the script back into ServerScriptService, then insert a RemoteFunction into ReplicatedStorage, and name it “PetRemote”, then on your script, replace this:
local RemoteFunction = game.ServerScriptService.PetRemote
to:
local RemoteFunction = game.ReplicatedStorage.PetRemote
wow worked perfectly! thanks!
only thing I think is the Invoke Servers are not firing do those work inside ServerScriptService?
cause im getting InvokeServer is not a valid member of RemoteEvent