Hi so i made a StarterCharacter and i made this:
3 red box is 3 hitbox
- TopHitbox
- MidHitbox
- LowHitbox
they are all weld to the HumanoidRootPart
I use RemoteEvent to make cilent β server
LocalScript (inside StarterCharacterScript):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TopRemoteEvent = ReplicatedStorage:WaitForChild("TopDamageTrigger")
local MidRemoteEvent = ReplicatedStorage:WaitForChild("MidDamageTrigger")
local LowRemoteEvent = ReplicatedStorage:WaitForChild("LowDamageTrigger")
UIS.InputBegan:Connect(function(Input, gpe)
if not gpe then
if Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 1 then
Slash1:Play()
Attackable = false
MidRemoteEvent:FireServer(Player,"True")--1st slash
wait(0.18)
Attackable = true--debounce
Combo = Combo + 1--make next move
print(Combo)--test
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 2 then
Slash2:Play()
Attackable = false
MidRemoteEvent:FireServer(Player,"True")--2nd slash
wait(0.18)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 3 then
Slash3:Play()
Attackable = false
TopRemoteEvent:FireServer(Player,"True")--3rd slash
wait(0.33)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 4 then
Slash4:Play()
Attackable = false
MidRemoteEvent:FireServer(Player,"True")--4th slash
wait(0.33)
Attackable = true
Combo = Combo + 1
print(Combo)
elseif Input.UserInputType == Enum.UserInputType.MouseButton1 and Attackable == true and Combo == 5 then
Slash5:Play()
Attackable = false
LowRemoteEvent:FireServer(Player,"True")--double
wait(0.2)
LowRemoteEvent:FireServer(Player,"True")--slash
wait(0.3)
Attackable = true
Combo = Combo - 4--reset combo
print(Combo)
end
end
end)
Server script (in ServerScriptService):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TopRemoteEvent = ReplicatedStorage:WaitForChild("TopDamageTrigger")
local MidRemoteEvent = ReplicatedStorage:WaitForChild("MidDamageTrigger")
local LowRemoteEvent = ReplicatedStorage:WaitForChild("LowDamageTrigger")
TopRemoteEvent.OnServerEvent:Connect(function(x)
print(x)--test
--make TopHitbox Damage
end)
MidRemoteEvent.OnServerEvent:Connect(function(y)
print(y)
--Make MidHitbox Damage
end)
LowRemoteEvent.OnServerEvent:Connect(function(z)
print(z)
--Make LowHitbox Damage
end)
can someone help me PLEASE because i cant define the player character in server script (to define the hitbox)
- - Also, i just learn how to use RemoteEvent on YT - -