corrija os erros : 12:13:45.489 Players.CINRILO.Backpack.Slingshot.LocalScript:81:…
- User
corrija os erros : 12:13:45.489 Players.CINRILO.Backpack.Slingshot.LocalScript:81: attempt to index nil with 'Play' - Cliente - LocalScript:81, e 12:13:46.753 Players.CINRILO.Backpack.Slingshot.LocalScript:91: attempt to index nil with 'Stop' - Cliente - LocalScript:91 desse script : local player = game.Players.LocalPlayer local mouse = player:GetMouse() local tool = script.Parent local PullBackAnim, ReleaseAnim local isAiming = false local aimingStartTime local trajectoryLine local MAX_FORCE = 100 -- You can adjust this value to change the maximum force of the slingshot local cooldown = 1 -- Cooldown in seconds local lastShotTime = 0 local ammo = 10 -- Starting ammo, adjust as needed
-- Mobile support local UIS = game:GetService("UserInputService") local isMobile = UIS.TouchEnabled and not UIS.MouseEnabled
-- Animations local humanoid = nil local animator = nil
-- Sounds local pullSound = tool:WaitForChild("PullSound") local releaseSound = tool:WaitForChild("ReleaseSound")
-- RemoteEvent local launchProjectileEvent = tool:WaitForChild("LaunchProjectile")
-- Function to create the trajectory line local function createTrajectoryLine() trajectoryLine = Instance.new("Part") trajectoryLine.Anchored = true trajectoryLine.CanCollide = false trajectoryLine.Transparency = 0.5 trajectoryLine.BrickColor = BrickColor.new("White") trajectoryLine.Material = Enum.Material.Neon trajectoryLine.Size = Vector3.new(0.2, 0.2, 0.2) trajectoryLine.Name = "TrajectoryLine" trajectoryLine.Parent = workspace end
-- Function to update the trajectory line local function updateTrajectoryLine(origin, direction, force) -- Clear previous line for _, part in pairs(workspace:GetChildren()) do if part.Name == "TrajectoryPart" and part:IsDescendantOf(workspace) then part:Destroy() end end
codelocal NUM_POINTS = 50 local timeStep = 0.1 local gravity = workspace.Gravity local lastPoint = origin for i = 1, NUM_POINTS do local t = i * timeStep local displacement = direction * force * t + 0.5 * Vector3.new(0, -gravity, 0) * t * t local currentPoint = origin + displacement local segment = Instance.new("Part") segment.Anchored = true segment.CanCollide = false segment.Transparency = 0.5 segment.BrickColor = BrickColor.new("White") segment.Material = Enum.Material.Neon segment.Size = Vector3.new(0.1, 0.1, (currentPoint - lastPoint).magnitude) segment.CFrame = CFrame.new(currentPoint, lastPoint) * CFrame.new(0, 0, -segment.Size.Z / 2) segment.Name = "TrajectoryPart" segment.Parent = workspace lastPoint = currentPoint end - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.