#deleted
17 messages · Page 1 of 1 (latest)
✅ 4. Use Activated Instead of ClickDetector (For Equippable Tools)
If the tool is equipped but the attack isn’t working, use Tool.Activated instead of ClickDetector:
code to fix using Activated:
local tool = script.Parent
tool.Activated:Connect(function()
print("Tool was clicked while equipped!")
end)
i just try these steps lets see if it solve:
@split cove These are some solutions to my problem that took ages to solve
** You are now Level 6! **
i just try Activated
✔ Use Tool.Activated if clicking while holding the tool
i need to run on the script not in console
error in console:
06:47:28 -- console:1: attempt to inex nil with 'Parent'
06:47:28 -- Stack Begin
06:47:28 -- Script 'console', Line 1
06:47:28 -- Stack End
fixed code to error on StarterPlayerScripts LocalScript:
local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService") -- Corrected variable name
local camera = workspace.CurrentCamera
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.MouseButton1 and not gameProcessedEvent then
local mousePosition = UserInputService:GetMouseLocation()
local ray = camera:ScreenPointToRay(mousePosition.X, mousePosition.Y)
local hit = workspace:FindPartOnRay(ray)
if hit then
print("Mouse clicked at position: " .. tostring(hit.Position))
end
end
end)
error in console:
07:14:14 -- console:5: Incomplete statement: expected assignment or a function call
