local UIS = game:GetService("UserInputService")
local rp = game:GetService("ReplicatedStorage")
local hit = rp.RemoteEvents:FindFirstChild("Hit")
print("Запуск")
UIS.InputBegan:Connect(function(input, _gameprocess)
if _gameprocess then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print("Нажата кнопка")
hit:FireServer()
end
end
end)
server code:
local rp = game:GetService("ReplicatedStorage")
local event = rp.RemoteEvents:WaitForChild("Hit")
local t = rp:WaitForChild("t")
local function InWork()
print("hohoho")
t.Parent = workspace
end
event:FireAllClients(InWork)
local rp = game:GetService("ReplicatedStorage")
local event = rp.RemoteEvents:WaitForChild("Hit")
local t = rp:WaitForChild("t")
local function InWork()
print("hohoho")
t.Parent = workspace
end
event.OnServerEvent:Connect(InWork)
IF you want it to work when you’re not typing or something like that.
Updated script:
local UIS = game:GetService("UserInputService")
local rp = game:GetService("ReplicatedStorage")
local hit = rp.RemoteEvents:FindFirstChild("Hit")
print("Запуск")
UIS.InputBegan:Connect(function(input, _gameprocess)
if not _gameprocess then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print("Нажата кнопка")
hit:FireServer()
end
end
end)