Is it possible to pass a function in the parameters of :FireServer()?

So i know when you are gonna use FireServer() You can pass values to the server like

local value = "Blue"
local event = pathwaytoevent
event:FireServer(value)

and you can pass it right, but can you like pass a function? Lets say in the script above, our variable “value” is a function that changes the property of a brick, and when you pass the function to the server and from there you can do whatever you want from it.
example:

local value = function()
   --do something
end
local event = pathwaytoevent
event:FireServer(value)

is that possible? how would you script that out (passing a function through the FireServer() parameters)

The reason I want to know this is so I can manage my main menu easier, my main menu uses camera manipulation (to make a cool background of the main menu) it anchors the player’s HumanoidRootPart so they can’t move around, and sets all the coreGUI to be non-visible. once they pick their team and whatnot, it will set their Camera to normal, Unanchors the HumanoidRootPart, and sets their CoreGUI back to normal. but you have to un-anchor the players HumanoidRootPart through the server, so thats why I’m wondering, so I can pass a function that sets their CoreGUI and camera to normal to the server, and also unanchor the HumanoidRootPart, here it is kinda scripted out so I can make more sense:

event.OnServerEvent:Connect(function(player,--function that i passed through the client that sets the players CoreGUI and camera to normal--)
--function
--un-anchor the player's HumanoidRootPart
player:LoadCharacter()
end)

Side Note: The event is gonna fire when the player clicks a GUI
I’m a bad explainer so if you want more information please say so

2 Likes

Quick search.mov

If that function returns something then yeah you can, else I never tested

local function giveString()
    return "bruh"
end
1 Like

Also u might want to tell us what ur trying to achieve so we may be able to help u in a better manner
Edit: didn’t see the full post sry and to prevent them from moving setting humanoid walkspeed to 0 is a better idea

1 Like

ah, so that does seem a better idea since I can change the HumanoidWalkSpeed through a local script right?

2 Likes

Sorry for the late reply. I was asleep
Yeah you can.

game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0

I even made a troll gnome part using this. As soon as u click the part a gnome decal appears on it and u cant move, and a gnome sound plays too. after the sound ends the gnome disappeared and i set the walkspeed to 16 (default)

1 Like