Not working code

I can’t understand why not working…
local code:

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)

To connect a function to when an event is fired:

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)

This code too not working, also… ahhh

Also,

you may want to change it to

if not _gameprocess then

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)

This code also like my code…

Just i not have errors in label, but code doesn’t work

The “not” has been added in. 30char

WAIT whaat, k this work thx. I love u :3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.