Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

FireServer is not a valid member of script?!

Asked by 3 years ago
Edited by Leamir 3 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

hello devs

I got some help setting up my first RemoteEvent yet it still doesn't work and gives the error

FireServer is not a valid member of script

my tiny brain is not following why its happening due to looking at the script and its flawless (to me)

my local script(inside a shop GUI) is

local Event = game.ReplicatedStorage.PetRemote
Event:FireServer(petName)

and my remote event (RepStorage) is

local Event = Instance.new(game.ReplicatedStorage.PetRemote)
Event.Name = "PetRemote"
Event.OnServerEvent:Connect(function(Player,Value)
      print("Value received from client, Player:",Player.Name,"Value:",Value)
end)

Won't Print

0
Can you please format your script into a code block? rabbi99 714 — 3y
0
would it be easier to not create a new event? Eric_pokemon 133 — 3y
0
yeah use the code block Eric_pokemon 133 — 3y
0
ok sorry guys new to this site CrillicD 0 — 3y
View all comments (3 more)
0
I made them both code blocks, It has to be a new event due to im trying to contact server from local script CrillicD 0 — 3y
0
remove lua zadobyte 692 — 3y
0
yea emervise 123 — 3y

1 answer

Log in to vote
0
Answered by
Pupppy44 671 Moderation Voter
3 years ago

I don't understand what you're doing. Here, make sure there's already a remote in ReplicatedStorage called "PetRemote":

local Event = game:GetService("ReplicatedStorage"):WaitForChild("PetRemote") -- Getting the remote, I don't know why you did Instance.new
Event.OnServerEvent:Connect(function(Player,Value)
      print("Value received from client, Player:",Player.Name,"Value:",Value)
end)

Hope this helps

Ad

Answer this question