I was working on a script to make my gun lock then the tool is equipped. i works but then when I unequipped i it stays I've tried to set the setting to false that didn't work here's the script:
local player = game.Players.LocalPlayer local uis = game:GetService("UserInputService") local mouse = print("Holding gun")
repeat wait(1) until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local animation = Instance.new("Animation")
animation.Name = "Idle"
animation.Parent = script.Parent
animation.AnimationId = "http://www.roblox.com/asset/?id=6688751964"
local animtrack = humanoid:LoadAnimation(animation)
script.Parent.Equipped:connect(function() mouse = true if mouse == true then uis.MouseBehavior = Enum.MouseBehavior.LockCenter end animtrack:Play()
end)
script.Parent.Unequipped:connect(function() mouse = false if mouse == false then uis.MouseBehavior = Enum.MouseBehavior.LockCenter == false end animtrack:Stop()
end)

5 comments
Click "Accept Answer" beside my answer if this helped
It did thank you
I did but when I refresh it doesn't accept the answer
ok now it did
Anyways I'm glad this helped