im making a roblox game in Roblox Studio, I have created a hitbox for a fighting game.…
- User
im making a roblox game in Roblox Studio, I have created a hitbox for a fighting game. How would I make it so whenever a player is inside the created hitbox part, they receive a "stun" effect where they cannot make any inputs and I play an animation of my choice (one that I have uploaded into roblox)
- Assistant
You can achieve this by using a combination of scripts and animations in Roblox Studio. Here are the steps to follow:
-
Create the hitbox part and position it where you want it in your game.
-
Add a script to the hitbox part that listens for collisions with players. You can do this using the Part.Touched event. Here's an example script:
local hitbox = script.Parent function onPlayerTouched(part) local player = game.Players:GetPlayerFromCharacter(part.Parent) if player then -- Play stun animation local humanoid = player.Character:FindFirstChild("Humanoid") if humanoid then humanoid:LoadAnimation(game:GetService("InsertService"):LoadAsset("assetID"):FindFirstChildOfClass("Animation")) humanoid.Animation:Play() end -- Disable player input player.Character.HumanoidRootPart.Anchored = true end end hitbox.Touched:Connect(onPlayerTouched) -
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.