Hi,
I am trying to make a Fireserver event work by sending information to the server side.
However, for unknown reasons this does not work, I’ve tried looking around for solutions but they were similar to my script for they worked. So I have no Idea why it shouldn’t. I’ve checked everything if they’re correct and they are.
Local
local UIS = game:GetService("UserInputService")
local event = script.Parent:WaitForChild("RemoteEvent")
UIS.InputBegan:Connect(function(k)
if k == Enum.KeyCode.A then
event:FireServer("lefton")
end
end)
UIS.InputEnded:Connect(function(k)
if k == Enum.KeyCode.A then
event:FireServer("leftoff")
end
end)
UIS.InputBegan:Connect(function(k)
if k == Enum.KeyCode.D then
event:FireServer("righton")
end
end)
UIS.InputEnded:Connect(function(k)
if k == Enum.KeyCode.D then
event:FireServer("rightoff")
end
end)
Server
local leftb = script.Parent.Left
local rightb = script.Parent.Right
local server = script.Parent:WaitForChild("RemoteEvent")
leftb.MouseButton1Down:Connect(function()
script.Parent.L.Value = true
end)
leftb.MouseButton1Up:Connect(function()
script.Parent.L.Value = false
end)
rightb.MouseButton1Down:Connect(function()
script.Parent.R.Value = true
end)
rightb.MouseButton1Up:Connect(function()
script.Parent.R.Value = false
end)
server.OnServerEvent:Connect(function(info)
if info == "lefton" then
script.Parent.L.Value = true
end
end)
server.OnServerEvent:Connect(function(info)
if info == "leftoff" then
script.Parent.L.Value = false
end
end)
server.OnServerEvent:Connect(function(info)
if info == "righton" then
script.Parent.R.Value = true
end
end)
server.OnServerEvent:Connect(function(info)
if info == "rightoff" then
script.Parent.R.Value = false
end
end)
Any help would be appriciated.