Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- LocalScript placed in the character (e.g., StarterPlayerScripts)
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local radius = 10 -- The range of the kill aura (in studs)
- local damage = 50 -- The amount of damage the aura does
- -- Create a part to detect other parts within the radius
- local auraPart = Instance.new("Part")
- auraPart.Size = Vector3.new(radius * 2, 1, radius * 2)
- auraPart.Shape = Enum.PartType.Ball
- auraPart.Position = character.HumanoidRootPart.Position
- auraPart.Anchored = true
- auraPart.CanCollide = false
- auraPart.Transparency = 1
- auraPart.Parent = game.Workspace
- -- Function to deal damage to characters within the aura
- local function dealDamage(part)
- local character = part.Parent
- if character:IsA("Model") and character:FindFirstChild("Humanoid") then
- local humanoid = character:FindFirstChild("Humanoid")
- humanoid:TakeDamage(damage)
- end
- end
- -- Detect parts entering the aura area
- auraPart.Touched:Connect(function(part)
- -- Only deal damage to humanoid characters
- dealDamage(part)
- end)
- -- Update aura position to follow the player
- game:GetService("RunService").Heartbeat:Connect(function()
- if character:FindFirstChild("HumanoidRootPart") then
- auraPart.Position = character.HumanoidRootPart.Position
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment