I want to know how i can change a players hitbox. I tried changing it in some ways to make the hitbox be infront of the player. but i couldnt.
If you wanted the hitbox to be in front of the player or something weird like that, you could like make a separate part, and use that as a hitbox. You could make so whenever that part is touched, it damages the humanoid or whatever you want to do with it.
So in like ServerScriptService you could make a script and put a part in it and do this:
local part = script:WaitForChild("Part") game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) part.Anchored = true part.Transparency = 1 part.CanCollide = false part.Name = player.Name -- I made the part auto-name itself the players name so you could reference the player later on. while wait(0.1) do part.Position = char:WaitForChild("HumanoidRootPart").CFrame.p + Vector3.new(0,10,0) -- CFrame is a little confusing, but you can google it and figure it out, but CFrame.p is just another, possibly more efficient way of saying Position. Adding the Vector3 makes so the part will be placed above the player, you can change this how you want. end end) end)
Inside the part you could do something like:
local part = script.Parent part.Touched:Connect(function() local player = game.Players:WaitForChild(part.Name) -- Finds the player using the name of the part. local char = game.Workspace:WaitForChild(player.Name) local humanoid = char:WaitForChild("Humanoid") local db = false if db = false then -- The whole db thing just makes so it damages every second instead of as fast as the computer can handle. humanoid:TakeDamage(5) db = true wait(1) db = false end end)
If you don't understand any of this, and you want to learn scripting, I suggest looking up AlvinBlox's beginner scripting tutorial. He may be a kid, but that's how I started.
You're asking a pretty broad question, but I'll provide a simple solution.
If you want the hitbox to be solely in front of the player, create a part with CanCollide set to false, Transparency set to 1, and a weld that attaches one stud away from the front of the player's torso. Name this part "Hitbox" for the sake of simplicity.
Let's say a sword touches the Hitbox part; script it to where when that happens, it will subtract X amount of health points from the player's Humanoid. Make sure to add a debounce of course.
This is the best way I can think of to answer your question. If this isn't quite what you're looking for, I suggest you leave a comment so that we can work this out. Also, I highly suggest that you be more detailed with your questions from here on out; people will not want to answer you if all you have to offer is a sentence or two of information.