Turning a local script into a function

still get the same error that its not part of a folder, am I missing a local file

My English is too poor, i cant explain it…

1 Like

it was in the right direction though, it felt like it could of worked I’ll keep trying to mess around with your script.

You have 2 wrong things

1, you are trying to connect OnServerEvent at folder, change to RemoteEvent.OnServerEvent

2, OnServerEvent:Connect, call it from server script (nomal script), RemoteEvent:FireServer(some value) call from client (localscript).

(you have to create RemoteEvent)

Where did yo put event? It must be in ReplicatedStorage.

but if I put the script inside rep storage I can connect it to a local script?

I gave you part of local script, i gave you stuff to put in local script, you nead difrent settup for server script service.

Server funtcions



Server code (Script)

local Event = Instance.new("RemoteEvent",game.ReplicatedStorage)
Event.Name = "SomeEvent"
  print("Value recived from client:",Value)

Client code (LocalScript):

local Event = game.ReplicatedStorage.SomeEvent
Event:FireServer("This is string send by client")

Oops, Server code is wrong

correct one:

local Event = Instance.new("RemoteEvent",game.ReplicatedStorage)
Event.Name = "SomeEvent"
  print("Value recived from client, Player:",Player.Name,"Value:",Value)
1 Like

alright ima sit down and try to edit this thank you for taking your time and writing this out! I’m kind of following what you did and how to proceed hopefully this works

1/1, clear and not hard, you explained it like teacher…

If you can please help me:

Running into error FireServer not a Valid member of script?

have it wrote out I would think correctly

and my Rep Storage Script

sorry still not following 100% why this won’t link them correctly

please tell me what you tried with event:fireserver(“player.eqippedpet.Value=petname”)

Ok, Change code

Event.Name = "SomeEvent"


Event.Name = "PetRemote"

Also, change

local Event = game.ReplicatedStorage.Bang


local Event = game.ReplicatedStorage.PetRemote
1 Like

And, you should change

Event:FireServer("player.EquippedPet.Value = petName")



this doesn’t help with the error FireServer not a vail member of script?
petName was underscored so I added l added

local petName = player.EquippedPet.Value

that helped the red but not the error

Is PetRemote(Script) in Replicated Storage?
Please change the name
PetRemote is automatically generated by the code.

-- command bar
local Remote = Instance.new('RemoteEvent')
Remote.Name = 'Remote Event stuff'
Remote.Parent = game:GetService('ReplicatedStorage')

-- server
local Replicated = game:GetService('ReplicatedStorage')
local Event = Replicated['Remote event stuff']

Event.OnServerEvent:Connect(function(Player, PetName, ...)
	-- The player instance is passed automatically and is always the first parameter in OnServerEvent.
	print(Player .. ' | ' .. PetName)

-- client
local Replicated = game:GetService('ReplicatedStorage')
local Event = Replicated:WaitForChild('Remote event stuff')

Event:FireServer('Pet name')

Try to see if the issue still occurs.