#Introduction
Currently, I'm remaking the old .Touched system of my tools, and I have recently just discovered that a ServerScript can be used to make .InputBegan stuff. Now, I have a new error.
You see, the BackpackGui.Frame.Handler.Equipped is an ObjectValue for my inventory system. However, the ServerScript is not detecting when the player's ObjectValue named "Equipped".
#Script
Here is my script:
local UIS = game:GetService("UserInputService")
local player = game.Players.PlayerAdded:Wait()
local char = player.Character or player.CharacterAdded:Wait()
local HumRP = char:WaitForChild('HumanoidRootPart')
local mouse = player:GetMouse()
local Tree = workspace.Tree
UIS.InputBegan:Connect(function(input)
if input.keyCode == Enum.KeyCode.E then
if mouse.Target and mouse.Target.Name == "Tree" then
if (HumRP.Position - Tree.Position).magnitude < 5 then
if player:WaitForChild('PlayerGui'):WaitForChild('Job').Value == "Lumberjack" then
if player:WaitForChild('PlayerGui'):WaitForChild('BackpackGui'):WaitForChild('Frame'):WaitForChild('Handler'):WaitForChild('Equipped').Value == "[LUMBERJACK] Axe" then
print("Player is lumberjack, has mouse on target, pressed E and is in range of 5 studs.")
end
end
end
end
end
end)
Sorry for the bad formatting. I'm not sure if all of those :WaitForChild()'s are necessary.
#Conclusion / Problem
I have no idea why this is happening, I've debugged it and nothing worked. Any help please?
Sincerely, Sensei_Developer
