Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I make a key input work serverside?

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)

2 comments

0

remote events, server scripts cant use the UserInputService

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.