This script turns on and off a camera lock. There is a problem if the character dies with the tool in his hand it breaks the camera function.
local rs = game:GetService("ReplicatedStorage")
local module = rs:WaitForChild("StrafingController")
local controller = require(module)
script.Parent.Equipped:Connect(function()
controller:SetEnabled(true)
end)
script.Parent.Unequipped:Connect(function()
controller:SetEnabled(false)
end)
I need it also to set the controller to false if the player dies. I tried this but it did not work.
local rs = game:GetService("ReplicatedStorage")
local module = rs:WaitForChild("StrafingController")
local controller = require(module)
script.Parent.Equipped:Connect(function()
controller:SetEnabled(true)
if script.Parent.Parent.Humanoid.Health<= 0 then
controller:SetEnabled(false)
end
end)
script.Parent.Unequipped:Connect(function()
controller:SetEnabled(false)
end)
Anyone know how set this to false if the player dies as well?
Thanks