UIS not working (Client Sided)

I made this script for blocking but the UIS won’t work. I tried out adding a print onto it and it didn’t run. I put it into StarterCharacterScripts.

-- Services 
local RS = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")

-- Character
local plr = game:GetService("Players")
local char = plr.Character

-- Folders
local RSStorage = RS.Storage
local Events = RSStorage.RemoteEvents

-- Events 
local BlockingEvent = Events.Blocking

-- Values
local debounce = false


-- Functions
local function startBlocking()
	debounce = true 
	BlockingEvent:FireServer("Blocking")
	task.wait(1)
	debounce = false 
end

local function stopBlocking()
	BlockingEvent:FireServer("UnBlocking")
end

local function GuardBreak()
	BlockingEvent:FireServer("GuardBreak")
end

-- Main 

UIS.InputBegan:Connect(function(key, GPE)
	if GPE then return end
	
	if key.KeyCode == Enum.KeyCode.F then
		if not debounce then 
			print ("Local Blocking Started")
			startBlocking()
		end
		
	end
end)
	
-- 
UIS.InputEnded:Connect(function(key, GPE)
	if GPE then return end
	if key.KeyCode == Enum.KeyCode.F then
		print ("local Blocking")
		stopBlocking()
	end
end)

-- 



char:GetAttributeChangedSignal("Blocking"):Connect(function()
	if char:GetAttribute("Blocking") >= 100 then
		stopBlocking()
		GuardBreak()
	end
end)
-- Character
local plr = game:GetService("Players")
local char = plr.Character

your script is most probably erroring here i think you forgot to add .LocalPlayer

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