What do you want to achieve?
I’m trying to make an X and Y button for my plane
What is the issue?
Server isn’t receiving :FireServer() from the client
What solutions have you tried so far?
I’ve searched it up but nothing seems to be working
Local script
local usp = game:GetService("UserInputService")
local function test(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.Y then
print("Y")
local fire = script.Parent:WaitForChild("Y")
fire:FireServer()
end
if input.KeyCode == Enum.KeyCode.X then
print("X")
local fireEvent = script.Parent:WaitForChild("EngineOff")
fireEvent:FireServer()
end
end
end
usp.InputBegan:Connect(test)
Server script
local event = script.Parent.Controller:WaitForChild("Y")
local event2 = script.Parent.Controller:WaitForChild("EngineOff")
event2.Name = "RemoteEvent1"
local go = script.Parent.Parent.Go
local fx = script.Parent.Parent.Parent.Emitter.Effects
event.OnServerEvent:Connect(function()
print("YS")
go.Value = true
fx.SFX:Play()
end)
event2.OnServerEvent:Connect(function()
print("YS")
go.Value = false
fx.SFX:Stop()
end)
u dont have anything in the parameters for fireserver() so maybethats why becuase it has nothing to send.and u dont have anything for the .onserverevent
I believe that is not the issue. You can use FireServer() without passing any arguments. You dont need to add anything in the OnServerEvent, if you are not doing anything for the specific player.
local UIS = game:GetService("UserInputService")
local Event1 = script.Parent:WaitForChild("Y")
local Event2 = script.Parent:WaitForChild("EngineOff")
local function test(input, typing)
if typing then
return
end
if input.KeyCode == Enum.KeyCode.Y then
print("Y was pressed")
Event1:FireServer()
elseif input.KeyCode == Enum.KeyCode.X then
print("X was pressed")
Event2:FireServer()
end
end
UIS.InputBegan:Connect(test)