Hello everyone,
I'm working on a farming game right now, you might've seen my previous two posts the past several days, but i came across another issue that I have ABSOLUTELY NO IDEA how to fix. I made a tool called Seeds that when equipped, spawns a highlighter part on the ground and follows the players mouse at all times, and is supposed to instantiate some plants when you click with the tool equipped and the plant spawns where the highlighter is positioned.
Somehow I could not get this to work as the Seeds.Activated function just doesnt fire at all weirdly even with no errors being made and the tool being equipped. It might just be yet another classic case of incorrect referencing as im greatly prone to doing so I ask you guys yet again to please come and offer your assistence.
Any theories and suggestions are GREATLY appreciated!!
NOTE: I reduced the Activation function to its bare bones with only a print statement to guarantee if its working or not. It aint even with this solution.
CODE:
local Player = game.Players.LocalPlayer local userinputService = game:GetService("UserInputService") local Seeds = script.Parent local mouse = Player:GetMouse() Seeds.Equipped:Connect(function(player) if mouse.Target == game.Workspace.Baseplate then local Highlighter = game.ReplicatedStorage.Highlighter:Clone() Highlighter.Anchored = true Highlighter.Transparency = 0.5 Highlighter.Material = "Neon" Highlighter.CanCollide = false Highlighter.Parent = game.Workspace while true do local pos = mouse.Hit.Position Highlighter.Position = pos + Vector3.new(0, 0.5, 0) wait() mouse.TargetFilter = Highlighter end end end) Seeds.Unequipped:Connect(function() local world = game.Workspace if world:FindFirstChild("Highlighter") then local Highlighter = game.Workspace.Highlighter Highlighter:Destroy() Highlighter.CanQuery = true end end) Seeds.Activated:Connect(function() --- Seeds.Activated does not fire upon clicking with the highlighter within mouse position. print("working!") end)
Thanks!
This one was kind of a weird one to figure out. I think your problem is that the tool you give the player has the property "RequiresHandle" set to true, but the tool has no part named "Handle" so it can't be activated. So, you can either uncheck that, or add a part named "Handle" into the tool for the player to hold when they equip the tool.