Okay so im making a revive feature for my game and im not really sure how i can implement something that removes the tools when the player is downed. so for example a person is downed and they can still pull out a weapon and attack people in a downed state. so is there i way i can make it so you cant equip tools?
game.Players.PlayerAdded:Connect(function(p)
p.CharacterAdded:Connect(function(c)
local RequiredHealthToBeDowned = 25
local bleeddamagewhiledown = 0.05
local resethealthto100ondown = false
local Canmovewhendown = false
local downwalkspeed = 3.5
local Screamingenabledwhiledown = true
local Needreviveguienabled = true
local humanoid = c:WaitForChild("Humanoid")
repeat wait()
until humanoid
local robloxhealthscript = c:WaitForChild("Health")
local fallid =
local fallani = Instance.new("Animation")
fallani.AnimationId = "http://www.roblox.com/Asset?ID="..fallid
local fallanimation = humanoid:LoadAnimation(fallani)
local downid =
local downani = Instance.new("Animation")
downani.AnimationId = "http://www.roblox.com/Asset?ID="..downid
local downanimation = humanoid:LoadAnimation(downani)
local isdown = Instance.new("BoolValue")
isdown.Value = false
isdown.Parent = c
isdown.Name = "isdown"
local isbeingrevived = Instance.new("BoolValue")
isbeingrevived.Value = false
isbeingrevived.Parent = c
isbeingrevived.Name = "isbeingrevived"
local gotrevied = Instance.new("BoolValue")
gotrevied.Value = false
gotrevied.Parent = c
gotrevied.Name = "gotrevied"
local isdead = Instance.new("BoolValue")
isdead.Value = false
isdead.Parent = c
isdead.Name = "isdead"
local deb = false
humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if humanoid.Health <= RequiredHealthToBeDowned and isdown.Value == false and deb == false then
if isdead.Value == false then
isdown.Value = true
fallanimation:Play()
if Canmovewhendown == true then
humanoid.WalkSpeed = downwalkspeed
humanoid.JumpPower = 0
else
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
end
robloxhealthscript.Disabled = true
if resethealthto100ondown == true then
humanoid.Health = 100
end
local screams = game.ServerStorage:WaitForChild("Screams"):Clone()
local helpgui = game.StarterGui:WaitForChild("HelpGui"):Clone()
if Needreviveguienabled == true then
helpgui.Parent = c.Head
helpgui.Adornee = c.Head
helpgui.Enabled = true
end
wait(.5)
deb = true
if Screamingenabledwhiledown == true then
screams.Parent = c.Head
screams:Play()
end
end
end
end)
isdown.Changed:Connect(function()
while isdown.Value == true do
wait(0.1)
if deb == true then
downanimation:Play()
end
if isbeingrevived.Value == true then
else
humanoid.Health = humanoid.Health - bleeddamagewhiledown
end
end
end)
gotrevied.Changed:Connect(function()
if gotrevied.Value == true and isdown.Value == true then
gotrevied.Value = false
isdown.Value = false
deb = false
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
robloxhealthscript.Disabled = false
if c.Head:FindFirstChild("Screams") then
c.Head:FindFirstChild("Screams"):Destroy()
end
if c.Head:FindFirstChild("HelpGui") then
c.Head:FindFirstChild("HelpGui"):Destroy()
end
if humanoid.Health < RequiredHealthToBeDowned then
humanoid.Health = RequiredHealthToBeDowned + 5
end
if humanoid.Health > RequiredHealthToBeDowned then
humanoid.Health = humanoid.Health + 5
end
end
end)
humanoid.Died:Connect(function()
isdead.Value = true
if c:FindFirstChild("isdown") then
c:FindFirstChild("isdown"):Destroy()
end
if c:FindFirstChild("isbeingrevived") then
c:FindFirstChild("isbeingrevived"):Destroy()
end
if c:FindFirstChild("gotrevied") then
c:FindFirstChild("gotrevied"):Destroy()
end
wait(0.7)
if c.Head:FindFirstChild("Screams") then
c.Head:FindFirstChild("Screams"):Destroy()
end
if c.Head:FindFirstChild("HelpGui") then
c.Head:FindFirstChild("HelpGui"):Destroy()
end
end)
isbeingrevived.Changed:Connect(function()
if isbeingrevived.Value == true and isdown.Value == true then
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
elseif isbeingrevived.Value == false and isdown.Value == true then
if Canmovewhendown == true then
humanoid.WalkSpeed = downwalkspeed
humanoid.JumpPower = 0
else
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
end
end
end)
end)
end)