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.
RemoteEvent

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
game.ReplicatedStorage.Revent:FireClient(player,values)

game.ReplicatedStorage.Revent:FireAllClients(values)

game.ReplicatedStorage.Revent.OnServerEvent:Connect(function(player,values)

Server code (Script)

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

Client code (LocalScript):

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

Oops, Server code is wrong

correct one:

local Event = Instance.new("RemoteEvent",game.ReplicatedStorage)
Event.Name = "SomeEvent"
Event.OnServerEvent:Connect(function(Player,Value)
  print("Value recived from client, Player:",Player.Name,"Value:",Value)
end)
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"

to

Event.Name = "PetRemote"

Also, change

local Event = game.ReplicatedStorage.Bang

to

local Event = game.ReplicatedStorage.PetRemote
1 Like

And, you should change

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

to

Event:FireServer(petName)
2 Likes

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)
end)

-- 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.