hello everyone
I’ve started making a game with new input system that adds 3 new instances (input context, action and bindings)
Everything works fine in the studio, but when I join the actual game input binding won’t even react to player’s actions
I couldn’t find any issues in my client script of the tool
Made a lil debug UI so I could check if everything’s active
Whole client script and video below ![]()
![]()
![]()
-- Here's the client script of the tool
local tool = script.Parent
local handle = tool.Handle
local model = tool.Model
tool:SetAttribute("Equipped", false)
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterPlayer = game:GetService("StarterPlayer")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local entity: Model = player.Character
local humanoid: Humanoid = entity:WaitForChild("Humanoid")
local rightArmIK: IKControl = humanoid:WaitForChild("RightArmIK")
local torsoIK: IKControl = humanoid:WaitForChild("TorsoIK")
local HRP = entity:WaitForChild("HumanoidRootPart")
local aim = HRP:WaitForChild("Aim")
local camera = workspace.CurrentCamera
local playerGui = player.PlayerGui
local combat: InputContext = playerGui.Combat
local controlTool: InputAction = combat.ControlTool
local inputBinding: InputBinding = controlTool.InputBinding
local sharedLibaries = ReplicatedStorage.SharedLibraries
local raycastHitbox = require(sharedLibaries.RaycastHitboxV4)
local sharedUtils = require(sharedLibaries.SharedUtils)
local ev_Replication = tool.Replication
local hitbox = raycastHitbox.new(model)
hitbox.Visualizer = false
hitbox.DetectionMode = 3
local oldMousePos: Vector2 = Vector2.new(0, 0)
local magnitudeRequirement = .35
local aimConnection
local serverConnection
print("fisrt") -- added those just to see if script is even working
hitbox.OnHit:Connect(function(hit)
print(hit)
if hit.Name == "Rice" then
ev_Replication:FireServer("Registration", hit)
end
end)
controlTool.StateChanged:Connect(function()
warn("STATE CHANGED SICKLE") -- doesn't work in the real game
end)
controlTool.Pressed:Connect(function()
warn("PRESSED") -- this won't even print in the output
if not tool:GetAttribute("Equipped") then warn("SICKLE NOT EQUIPPED") return end
-- Circle Crosshair
aimConnection = RunService.RenderStepped:Connect(function()
aim.WorldCFrame = player:GetMouse().Origin * CFrame.new(0, 0, -14)
end)
aim.BillboardGui.Enabled = true
UserInputService.MouseIconEnabled = false
-- Enable IKControls on the server
ev_Replication:FireServer("ToggleIK", true)
-- Now we update the "target" of IKControls and enable hitbox if there's enough force
serverConnection = RunService.RenderStepped:Connect(function()
local mousePos = Vector2.new(player:GetMouse().X, player:GetMouse().Y)
local mouseDelta = mousePos - oldMousePos
oldMousePos = mousePos
ev_Replication:FireServer("UpdateTarget", mousePos, mouseDelta, player:GetMouse().Origin)
if entity:GetAttribute("ArmStamina") < 5 then return end
for index, scenarios in magnitudes do
if entity:GetAttribute("ArmStamina") <= tonumber(scenarios[1]) then
magnitudeRequirement = tonumber(scenarios[2])
break
end
end
print(magnitudeRequirement)
if mouseDelta.Magnitude / 50 > magnitudeRequirement then -- did "/ 50" so it will be easier to activate the hitbox
hitbox:HitStart()
model.Main.Trail.Enabled = true
TweenService:Create(tool.Handle.Swing, TweenInfo.new(.1), {PlaybackSpeed = 1 / (mouseDelta.Magnitude / 50)}):Play()
else
coroutine.wrap(function() -- Little delay
task.wait(.1)
hitbox:HitStop()
end)()
TweenService:Create(tool.Handle.Swing, TweenInfo.new(.1), {PlaybackSpeed = 0}):Play()
model.Main.Trail.Enabled = false
end
end)
end)
print("second") -- added those just to see if script is even working
controlTool.Released:Connect(function()
if not tool:GetAttribute("Equipped") then return end
ev_Replication:FireServer("ToggleIK", false)
TweenService:Create(tool.Handle.Swing, TweenInfo.new(.1), {PlaybackSpeed = 0}):Play()
UserInputService.MouseIconEnabled = true
model.Main.Trail.Enabled = false
aim.BillboardGui.Enabled = false
UserInputService.MouseIconEnabled = true
hitbox:HitStop()
aimConnection:Disconnect()
serverConnection:Disconnect()
end)
tool.Equipped:Connect(function()
tool:SetAttribute("Equipped", true)
combat.Enabled = true -- here I enable context
player.CameraMaxZoomDistance = 10
warn("SICKLE EQUIPPED")
end)
tool.Unequipped:Connect(function()
tool:SetAttribute("Equipped", false)
combat.Enabled = false -- here I disable context
ev_Replication:FireServer("ToggleIK", false)
TweenService:Create(tool.Handle.Swing, TweenInfo.new(.1), {PlaybackSpeed = 0}):Play()
UserInputService.MouseIconEnabled = true
model.Main.Trail.Enabled = false
aim.BillboardGui.Enabled = false
UserInputService.MouseIconEnabled = true
hitbox:HitStop()
if aimConnection ~= nil then
aimConnection:Disconnect()
end
if serverConnection ~= nil then
serverConnection:Disconnect()
end
player.CameraMaxZoomDistance = 15
warn("SICKLE unEQUIPPED")
end)
print("third initiated") -- added those just to see if script is even working
Here’s the video
If quality is bad or video won’t start, then it is still uploading
hope that I’ll find the solution because I’ve spent a lot of time making this ![]()
![]()