Hello, So I am making a hitbox with math.random featured. I don’t know if this is a problem on my end or the scripts end cause, there’s 3 different modes that I’ve made. But instead of choosing every mode it only spams one mode.
Script:
-- Key Instances --
local Folder = game:GetService('ReplicatedStorage').Remotes
local TackScript = script.Parent
local TRemote = Folder.TRemote
local RRemote = Folder.RRemote
local HitChance = math.random(1,3)
---
-- Debounce --
local Debounce = false
---
script.Parent.Parent.Torso.Touched:Connect(function(Hit)
if Hit.Name == 'Torso' then
-- Work Debounce --
if not Debounce then Debounce = true
print(HitChance)
-- Work HitChance --
if HitChance == 1 then
script.Parent.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
TRemote:FireServer('Tackle')
RRemote:FireServer('Ragdoll')
TackScript.Disabled = true
wait(2)
script.Parent.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
RRemote:FireServer('Unragdoll')
Debounce = false
TackScript.Disabled = false
--elseif HitChance == 2 then
-- script.Parent.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
-- TRemote:FireServer('PBU')
-- RRemote:FireServer('Ragdoll')
-- TackScript.Disabled = true
-- wait(2)
-- script.Parent.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
-- RRemote:FireServer('Unragdoll')
-- Debounce = false
-- TackScript.Disabled = false
elseif HitChance == 2 then
TRemote:FireServer('Stumble')
TackScript.Disabled = true
wait(2)
Debounce = false
TackScript.Disabled = false
elseif HitChance == 3 then
script.Parent.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
TRemote:FireServer('Fumble')
RRemote:FireServer('Ragdoll')
TackScript.Disabled = true
wait(2)
script.Parent.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
RRemote:FireServer('Unragdoll')
Debounce = false
TackScript.Disabled = false
end
end
end
end)
---