I have a inventory system, and inside of that is a ObjectValue that is named Equipped. In my script, I want the code to fire ONLY when the player has an Axe equipped. However, the script is not detecting Equipped's value.
Here's my script. [ServerScript in a part]
local player = game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
while not character.Parent do
character.AncestryChanged:Wait()
end
local Humanoid = character:WaitForChild('Humanoid')
local HRP = character:WaitForChild('HumanoidRootPart')
local mouse = player:GetMouse()
local Anim = Instance.new("Animation",script.Parent)
Anim.Name = "ChopAnim"
Anim.AnimationId = 'rbxassetid://3027147369'
local Animation = Humanoid:LoadAnimation(Anim)
local Part = script.Parent
local Equipped = player.PlayerGui:WaitForChild('BackpackGui'):WaitForChild('Frame').Handler.Equipped
game.ReplicatedStorage.PressedE.OnServerEvent:Connect(function()
if Equipped.Value == "[LUMBERJACK] Axe" then
if (HRP.Position - Part.Position).magnitude < 4.5 then
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
Animation:Play()
end
end
end)
It's supposed to work, but isn't.
Can anyone help me please? I'm really desperate.
Regrets, Sensei_Developer

3 comments
Use the "equipped" function of the tool. Like "tool.equipped:Connect(function()" something like that. For make it easy
Okay, I'll try.
Nope.