Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local UserInputService = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- local Debris = game:GetService("Debris")
- local LocalPlayer = Players.LocalPlayer
- local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
- local Mouse = LocalPlayer:GetMouse()
- -- Get eye position
- local function getEyePos()
- local head = Character:FindFirstChild("Head")
- if not head then return nil end
- if Character:FindFirstChild("Humanoid") and Character:FindFirstChild("Humanoid").RigType == Enum.HumanoidRigType.R15 then
- return head.Position + Vector3.new(0.2, 0.3, 0) -- Offset for R15 eyes
- else
- return head.Position + Vector3.new(0.25, 0.25, 0) -- Offset for R6 eyes
- end
- end
- -- Fire one laser beam
- local function fireLaser(targetPos)
- local origin = getEyePos()
- if not origin then return end
- local laser = Instance.new("Part")
- laser.Anchored = true
- laser.CanCollide = false
- laser.Material = Enum.Material.Neon
- laser.BrickColor = BrickColor.new("Really red")
- laser.Size = Vector3.new(0.2, 0.2, (origin - targetPos).Magnitude)
- laser.CFrame = CFrame.new(origin, targetPos) * CFrame.new(0, 0, -laser.Size.Z / 2)
- laser.Parent = workspace
- Debris:AddItem(laser, 0.1)
- -- Raycast to damage
- local rayParams = RaycastParams.new()
- rayParams.FilterDescendantsInstances = {Character}
- rayParams.FilterType = Enum.RaycastFilterType.Blacklist
- local result = workspace:Raycast(origin, (targetPos - origin).Unit * 100, rayParams)
- if result and result.Instance then
- local target = result.Instance:FindFirstAncestorOfClass("Model")
- if target and target:FindFirstChild("Humanoid") and target ~= Character then
- target.Humanoid:TakeDamage(10)
- end
- end
- end
- -- Hold to laser loop
- local firing = false
- local stopLaser = false
- local function startLaser()
- if firing then return end
- firing = true
- while firing and not stopLaser do
- local targetPos = Mouse.Hit.Position
- fireLaser(targetPos)
- task.wait(0.1)
- end
- end
- local function stopLaserFunc()
- stopLaser = true
- firing = false
- task.wait(0.2)
- stopLaser = false
- end
- -- Mobile Tap & Hold Input
- UserInputService.TouchStarted:Connect(function()
- startLaser()
- end)
- UserInputService.TouchEnded:Connect(function()
- stopLaserFunc()
- end)
- -- Optional notification
- pcall(function()
- game.StarterGui:SetCore("SendNotification", {
- Title = "🔴 Laser Eyes Ready",
- Text = "Tap & hold to shoot from your eyes!",
- Duration = 5
- })
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement