Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How would I make a key input work serverside?

Asked by
exarlus 72
5 years ago

Im trying to make a gun flash however other players cant see it. How would I make this script work serverside so that other players can see it?

local Flash = script.Parent

local UserInputService = game:GetService("UserInputService")
local Tool = script.Parent
local Player = game.Players.LocalPlayer

UserInputService.InputBegan:Connect(function(InputObject)
    if InputObject.UserInputType == Enum.UserInputType.MouseButton1 then
       Flash.Enabled = true
if Flash.Enabled == true 
then
    wait(0.01)
    Flash.Enabled = false
end       
    end
end)
0
remote events, server scripts cant use the UserInputService theking48989987 2147 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

Write the input code into a local script inside of the gun. Then use a remote event inside of let's say the muzzle of the gun to contact the server and make the flash appear then disappear. Same script. Broke into two. Server script can be inside the gun to

Ad

Answer this question