server script inside of serverscriptservice
game.ReplicatedStorage.M1Fired.OnServerEvent:Connect(function(player)
local muchacho = require(game.ServerStorage.MuchachoHitbox)
local hitbox = muchacho.CreateHitbox()
local owner = (player.Name)
local didhit = false
game.Workspace:FindFirstChild(owner).Humanoid.WalkSpeed = 0
game.Workspace:FindFirstChild(owner).Humanoid.JumpPower = 0
hitbox.Size = Vector3.new(5, 5, 6)
hitbox.Transparency = 0.8
hitbox.Color = Color3.fromRGB(147, 0, 2)
hitbox.CanCollide = false
hitbox.Anchored = true
hitbox.Parent = workspace
hitbox.CFrame = player.Character.HumanoidRootPart.CFrame
hitbox.Offset = CFrame.new(0, 0, -3)
hitbox:Start()
hitbox.Touched:Connect(function(hum, hit)
if hit.Parent.Name ~= owner and didhit == false then
didhit = true
if hit.Parent.Humanoid then
if game.Workspace(owner):FindFirstChild("didthefinalhitofcombo").Value == false then
hit.Parent.Humanoid:TakeDamage(3)
hit.Parent:FindFirstChild("stuntime").Value = 0.35
if game.Workspace(owner):FindFirstChild("didthefinalhitofcombo").Value == true then
hit.Parent.Humanoid:TakeDamage(4)
hit.Parent:FindFirstChild("stuntime").Value = 0.5
hit.Parent:Destroy()
end
else
print("could not find humanoid")
end
end
end)
task.wait(0.1)
game.Workspace:FindFirstChild(owner).Humanoid.WalkSpeed = 10
game.Workspace:FindFirstChild(owner).Humanoid.JumpPower = 50
hitbox:Destroy()
end)
Local script inside of tool (i know its repetitive, but i am going to add animations.
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local m1count = 0
local m1cooldown = false
local full_m1cooldown = false
local function onInputBegan(input, gameProcessedEvent)
if not gameProcessedEvent and m1cooldown == false and input.UserInputType == Enum.UserInputType.MouseButton1 and script.Parent.Parent.Parent == workspace then
if script.Parent.Parent.stuntime.Value <= 0 then
if m1count == 0 then
m1cooldown = true
m1count += 1
game.ReplicatedStorage.M1Fired:FireServer(player)
wait(0.3)
m1cooldown = false
elseif m1count == 1 then
m1cooldown = true
m1count += 1
game.ReplicatedStorage.M1Fired:FireServer(player)
wait(0.3)
m1cooldown = false
elseif m1count == 2 then
m1cooldown = true
m1count += 1
game.ReplicatedStorage.M1Fired:FireServer(player)
wait(0.3)
m1cooldown = false
elseif m1count == 3 then
m1cooldown = true
m1count += 1
game.ReplicatedStorage.M1Fired:FireServer(player)
wait(0.3)
m1cooldown = false
elseif m1count == 4 then
script.Parent.Parent.didthefinalhitofcombo = true
m1cooldown = true
m1count += 1
game.ReplicatedStorage.M1Fired:FireServer(player)
wait(0.3)
m1cooldown = false
script.Parent.Parent.didthefinalhitofcombo = false
elseif m1count >= 5 and full_m1cooldown == false then
full_m1cooldown = true
wait(2)
m1count = 0
full_m1cooldown = false
end
elseif script.Parent.Parent.stuntime.Value > 0 then
print("ur stunned !")
end
end
end
UIS.InputBegan:Connect(onInputBegan)
im a beginner at scripting, so excuse the messiness.
on line 21 it says attempt to call instance value and this is the only method i could think of for checking when the player finishes their m1 combo.
- any feedback helps, im trying to get better!