Help with Tool.Enabled

I made a script that its supposed to make it so the player cant equip the tool if the players scale is less then 1.5 but it isnt working and nothing bad is showing in output since the print statement is coming out just fine

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Tool = script.Parent

while true do
local function onEquipped()
    local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
    local currentScale = character:GetScale()

    if currentScale < 1.5 then
	 Tool.Enabled = false
		print("1")
    end
end
wait(0.1)
Tool.Equipped:Connect(onEquipped)
end

I don’t think you need to place everything inside a while loop; just do

local function onEquipped()
    local character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
    local currentScale = character:GetScale()

    if currentScale < 1.5 then
	 Tool.Enabled = false
		print("1")
    end
end

Tool.Equipped:Connect(onEquipped)
1 Like

Firstly, you do not need a while loop for an event.

Tool.Enabled stops the tool from being able to be Activated. It does not prevent the player from equipping the tool. Try making the player unequip the tool as soon as they equip it, if their scale is greater than 1.5.

how would i make the player unequip the tool?

Set the parent of the Tool to the player’s backpack.

1 Like

its worked thank you so much i was so confused on how it would work

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.