hey, im trying to make a handcuff system with keybinds, everything works fine, if i put any other code not related to RemoteEvents it works perfectly, it doesnt even print when the other keybinds are pressed, I’ve tried many ways to fix this but it still doesnt work
Localscript:
popupEvent.OnClientEvent:Connect(function(target, action)
if target == nil or action == nil then return end
if action == "create" then
local popup = game.ReplicatedStorage.HandcuffPopup:Clone()
popup.Parent = target.Character.HumanoidRootPart
popup.Adornee = target.Character.HumanoidRootPart
popup.Popup.pUser.Text = target.Name
local actions = UIS.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
ActionsEvent:FireServer(input, target, xd[1])
end
end)
task.spawn(function()
while wait(.1) do
if popup == nil or target == nil or target.Character == nil or target.Character.Humanoid.Health == 0 then
actions:Disconnect()
break
end
end
end)
elseif action == "delete" then
if target.Character.HumanoidRootPart:FindFirstChild("HandcuffPopup") then
target.Character.HumanoidRootPart.HandcuffPopup:Destroy()
end
end
end)
ServerScript:
local actionCooldown = false
ActionsEvent.OnServerEvent:Connect(function(player, action, target, key)
if player == nil or player.Character == nil or player.Character.Humanoid.Health == 0 or action == nil or target == nil or typeof(key) ~= "string" or player.Name ~= config.owner or key ~= playerKey then return end
if action.KeyCode == Enum.KeyCode.E then
if actionCooldown == false then
actionCooldown = true
print("arrest")
wait(.15)
actionCooldown = false
end
elseif action.KeyCode == Enum.KeyCode.F then
if actionCooldown == false then
actionCooldown = true
local dist = (player.Character.Head.Position - target.Character.Head.Position).Magnitude
if dist <= (script.Parent.HandcuffPopup.MaxDistance/1.5) then
target.Character.Humanoid.WalkSpeed = 16
target.Character.Humanoid.JumpPower = 50
for _, a in pairs(target.Character.Humanoid:GetPlayingAnimationTracks()) do
a:Stop()
end
script.Parent.Popup:FireClient(player, target, "delete")
end
wait(.15)
actionCooldown = false
end
elseif action.KeyCode == Enum.KeyCode.Q then
if actionCooldown == false then
actionCooldown = true
print("search")
wait(.15)
actionCooldown = false
end
end
end)