You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to make the event work so when the hitbox touches player it knockbacks them and damages
-
What is the issue? Include screenshots / videos if possible!
I even added print statements, and seems like touchedconn event it doesnt work, but for some reason the hitbox.cancollide doesnt set to true too, Idk why. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried checking if I sent right instances in remote events, and they are
Here’s the Server Script
local rs = game:GetService("ReplicatedStorage")
local rockamount = 1
rs.specialrocks.ice.OnServerEvent:Connect(function(player, magnitude, damage, speed, hitbox, cooldown)
hitbox.CanCollide = true
print("c")
local touchedConn = hitbox.Touched:Connect(function(part)
print("a")
if part.Parent.Name ~= player.Name and cooldown.Value == false then
print("b")
cooldown.Value = true
local rockcoins = player.leaderstats.rockcoins
rockcoins.Value = rockcoins.Value + rockamount
local hum = part.Parent:FindFirstChild("Humanoid")
local torso = part.Parent:FindFirstChild("Torso")
if hum and torso and hum.Health > 0 then
hum:TakeDamage(damage)
local char = player.Character or player.CharacterAdded:Wait()
hum.WalkSpeed = 4
local facepart = char:FindFirstChild("FacePart")
local knockback = Instance.new("BodyVelocity")
knockback.Velocity = facepart.CFrame.LookVector * magnitude
knockback.P = 5000
knockback.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
knockback.Parent = torso
wait(0.1)
knockback:Destroy()
end
wait(speed)
hum.WalkSpeed = 16
cooldown.Value = false
end
end)
hitbox.CanCollide = false
touchedConn:Disconnect()
end)
And the local script
local tool = script.Parent.Parent
local hitbox = tool.Hitbox
local cooldown = tool:WaitForChild("cooldown")
local rs = game:GetService("ReplicatedStorage")
local damage = 20
local power = 225
local speed = 1
tool.Activated:Connect(function()
game.ReplicatedStorage.specialrocks.ice:FireServer(power, damage, speed, hitbox, cooldown)
end)
Thanks.
P.S. Only “c” prints