So Im trying to get a function to work through remote events because of FE
heres the code
Local Script
UserInput = game:GetService("UserInputService") function BigGay() p = Instance.new("Part") p.Parent = workspace end local remote = game.ReplicatedStorage.RemoteEvent UserInput.InputBegan:Connect(function(input,gameprocessed) if input.KeyCode == Enum.KeyCode.G then print('yaa prorooror da') remote:FireServer(BigGay()) end end)
And then the script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,spawnpart) spawnpart() end)
But this keeps erroring 20:33:34.236 - ServerScriptService.local:3: attempt to call local 'spawnpart' (a nil value)
A good idea would be to use remote functions. Here's a example with your code: Client: ```lua
local remotefunction = game:GetService("ReplicatedStorage").RemoteFunction
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input,gameProcessedEvent)
if input.KeyCode == Enum.KeyCode.G and not gameProcessedEvent then
print("reee")
remotefunction:InvokeServer()
end
end)
Server:
lua
local remotefunction = game:GetService("ReplicatedStorage").RemoteFunction
local function BigGay()
local p = Instance.new("Part")
p.Parent = workspace
end
remotefunction.OnServerInvoke = BigGay
```
there you have it, this is a example. Don't copy and paste this and not learn anything from it. This site is meant to teach you, not give you the answers. I used your code and implemented it to make it easier for you to understand. Please read more at: https://developer.roblox.com/articles/Remote-Functions-and-Events