I am trying to make a blocking system where i’ve added a boollvalue to the player and to other dummies the problem is when their blocking value changes it doesnt change in the hitbox script
hitbox.Touched:Connect(function(Hit)
if Hit.Parent.Name ~= Player.Name and Hit.Parent:FindFirstChild("Humanoid") and CanDamage == true then
local isblocking = Hit.Parent:FindFirstChild("Blocking")
if isblocking then
if isblocking.Value == false then
CanDamage = false
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
if Count ~= 1 then
sound:Play()
else
sound:Stop()
sound2:Play()
end
elseif isblocking.Value == true then
sound:Play()
end
end
end
end)
end)
Replicated_Storage.Shield_ServerSide.Remotes.Hit.OnServerEvent:Connect(function(Player,Count)
wait(0.25)
print(Player)
CanDamage = true
local hitbox = Instance.new("Part",workspace)
local sound = Instance.new("Sound",hitbox)
local sound2 = Instance.new("Sound",hitbox)
sound2.SoundId = script["Punch Kit Beefy Hit 2 (SFX)"].SoundId
sound.SoundId = script.Metal_Hit.SoundId
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = 1
hitbox.CFrame = Player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
hitbox.Size = Vector3.new(5,5,5)
game.Debris:AddItem(hitbox,1)
local hits = {}
hitbox.Touched:Connect(function(Hit)
if Hit.Parent.Name ~= Player.Name and Hit.Parent:FindFirstChild("Humanoid") and CanDamage == true then
local isblocking = Hit.Parent:FindFirstChild("Blocking")
if isblocking then
if isblocking.Value == false then
CanDamage = false
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
if Count ~= 1 then
sound:Play()
else
sound:Stop()
sound2:Play()
end
elseif isblocking.Value == true then
sound:Play()
end
end
end
end)
end)
Maybe I misunderstood your post. Is the problem that you are having, trying to play one sound if the count is a certain number, and another if its a different number? Or can you elaborate what the issue is.
if isblocking.Value == false then
CanDamage = false
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)
if Count ~= 1 then
sound:Play()
else
sound:Stop()
sound2:Play()
end
elseif isblocking.Value == true then
sound:Play()
end
end
Ooh no worries i added a script to the dummy that changes the value every 10 seconds and it worked
i think the script wont do when you r the one who changes it from the explorer