I am making a zombie survival game inspired on “left 4 dead”, and i decided to add a zombie called “strangler”, it has a ranged ability that captures non-zombie players and drags them to the zombie, i also decided to make so the zombie can’t move while using that ability by disabling the controls.
It mostly works fine, but my issue is that once you die as “strangler”, your controls get permanently disabled until you rejoin the server, it doesn’t matter on what team you are or which zombie you respawn as. That is a very anoying and gamebreaking issue that i couldn’t fix and i also couldn’t find what is causing it, can anyone help me out?
Some of strangler’s script that contains “:Enable()” and “:Disable()”:
local plr = game.Players.LocalPlayer
local controls = require(plr.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
local character = plr.Character
local Mouse = plr:GetMouse()
local debounce = false
local missed = true
local hum = character:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script.Parent:WaitForChild("Attack"))
local bladedebounce = false
local tonguedebounce = false
local dmg = 10
local req = script
local uis = game:GetService("UserInputService")
local gui = game.Players.LocalPlayer.PlayerGui
local mobileimage = script:WaitForChild("TextLabel")
local didt = game.Workspace:WaitForChild("ValueSystem"):WaitForChild("DamageIndicatorTime").Value
if uis.TouchEnabled == true then
gui.MobileButtons.SprintButton.Visible = false
gui.MobileButtons.ActionButton.Visible = true
end
uis.InputBegan:Connect(function(input,Typing)
if input.KeyCode == Enum.KeyCode.E and not Typing or input.KeyCode == Enum.KeyCode.ButtonB then
script.Activate.Value = true
end
end)
gui.MobileButtons.ActionButton.MouseButton1Click:Connect(function()
if script.MobileSkill.Value == 0 and script.Parent.TongueCooldown.Value == false then
script.MobileSkill.Value = 1
mobileimage.Parent = gui.MobileButtons
elseif script.MobileSkill.Value > 0 then
script.MobileSkill.Value = 0
mobileimage.Parent = script
end
end)
script:WaitForChild("Activate").Changed:Connect(function()
if script.Activate.Value == true and tonguedebounce == false and hum.Health > 0 and debounce == false and hum:GetState() == Enum.HumanoidStateType.Running then
tonguedebounce = true
debounce = true
missed = true
local pos = Mouse.Hit.Position
controls:Disable()
hum.AutoRotate = false
script.Parent.TongueEvent:FireServer(pos,hum,req)
script.Parent.Parent.HumanoidRootPart.SoundS.Volume = 0
local new = game.ReplicatedStorage.ClientProps.TongueC:Clone()
new.CFrame = CFrame.new(character.Head.Position,pos)
new.BodyVelocity.Velocity = new.CFrame.LookVector * 75
new.Beam.Attachment0 = character.Head.Attachment
new.Parent = game.Workspace.ProjectileSystem
new.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") ~= nil and part.Parent:FindFirstChild("Stats"):FindFirstChild("Infected").Value == false and part.Name ~= "Water" and part:FindFirstChild("BodyVelocity") == nil and part:FindFirstChild("Mesh") == nil and part:FindFirstChild("ExplosionSound") == nil then
new.CanTouch = false
missed = false
new:Destroy()
local hithum = part.Parent:FindFirstChild("Humanoid")
local grab = true
script.Parent.RemoteEvent:FireServer(hithum,dmg,grab,req)
script.Parent.TongueDestroy:FireServer(req)
wait(1)
repeat
wait(0.1)
until
script.Parent.Beam.Attachment0 ~= character.Head.Attachment
controls:Enable()
hum.AutoRotate = true
if hithum.Health > 0 and hum.Health > 0 then
local dmgindicator = game.ReplicatedStorage.ClientProps.DamageIndicator:Clone()
dmgindicator.CFrame = part.CFrame
dmgindicator.BillboardGui.TextLabel.Text = "-"..25
dmgindicator.BillboardGui.StudsOffset = Vector3.new(Random.new():NextNumber(-2,2),Random.new():NextNumber(-2,2),0)
dmgindicator.Parent = game.Workspace.ProjectileSystem
game:GetService("Debris"):AddItem(dmgindicator,didt)
end
wait(2)
debounce = false
wait(6)
script.Activate.Value = false
tonguedebounce = false
elseif part.Parent:FindFirstChild("Humanoid") == nil then
new:Destroy()
missed = false
controls:Enable()
hum.AutoRotate = true
script.Parent.TongueDestroy:FireServer(req)
wait(2)
debounce = false
wait(6)
script.Activate.Value = false
tonguedebounce = false
end
end)
wait(1.5)
if missed == true then
new:Destroy()
missed = false
controls:Enable()
hum.AutoRotate = true
script.Parent.TongueDestroy:FireServer(req)
wait(2)
debounce = false
wait(6)
script.Activate.Value = false
tonguedebounce = false
end
elseif script.Activate.Value ~= false then
script.Activate.Value = false
end
end)
hum.Died:Connect(function()
if missed == true then
script.Parent.TongueDestroy:FireServer(req)
end
if hum.AutoRotate == false then
controls:Enable()
hum.AutoRotate = true
end
end)