It only prints 1 in the server script!
Server Script:
local tiger = script.Parent
local humanoid = tiger:WaitForChild("Humanoid")
local debounce = true
game.ReplicatedStorage.TraitorAttack.OnServerEvent:Connect(function()
print(0)
for i,player in pairs(game.Players:GetPlayers()) do
print(1)
local target = player.Character
local distance = (tiger.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
if distance <= 8 and target and target ~= tiger and humanoid.WalkSpeed ~= 0 and debounce == true then
debounce = false
print(2)
tiger.Head.AttackSound:Play()
local playerDeath = game.ReplicatedStorage:WaitForChild("playerdeath")
local player = game.Players:GetPlayerFromCharacter(target)
local tigerplayer = game.Players:GetPlayerFromCharacter(tiger)
playerDeath:FireClient(player,tiger)
local attackAnim = humanoid:LoadAnimation(script.Attack)
attackAnim:Play()
attackAnim.Stopped:Wait()
target.Humanoid.Health = 0
tigerplayer.leaderstats.Meat.Value += 1
wait(10)
debounce = true
end
end
end)
Local Script:
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local canAttack = script.Parent:WaitForChild("CanAttack").Value
canAttack = false
game.ReplicatedStorage.RoundInfo.Status:GetPropertyChangedSignal("Value"):Connect(function()
if game.ReplicatedStorage.RoundInfo.Status.Value == "Intermission" or game.ReplicatedStorage.RoundInfo.Status.Value == "" then
canAttack = false
end
end)
uis.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Q or input.KeyCode == Enum.KeyCode.ButtonY or input.UserInputType == Enum.UserInputType.Touch then
if canAttack == true and player.Character.Name == "Traitor" then
print("Attacked")
game.ReplicatedStorage.TraitorAttack:FireServer()
end
elseif canAttack == false and game.ReplicatedStorage.RoundInfo.Status.Value == "Game" and player.Character.Name == "Traitor" then
print("Cannotattack")
wait(60)
canAttack = true
end
end)