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
6 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?

01local Flash = script.Parent
02 
03local UserInputService = game:GetService("UserInputService")
04local Tool = script.Parent
05local Player = game.Players.LocalPlayer
06 
07UserInputService.InputBegan:Connect(function(InputObject)
08    if InputObject.UserInputType == Enum.UserInputType.MouseButton1 then
09       Flash.Enabled = true
10if Flash.Enabled == true
11then
12    wait(0.01)
13    Flash.Enabled = false
14end      
15    end
16end)
0
remote events, server scripts cant use the UserInputService theking48989987 2147 — 6y

1 answer

Log in to vote
1
Answered by 6 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