Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need this tool to be permanently be selected. I don't know how?

Asked by 8 years ago

Here's my script:

---//SE-006 Script made by Cyotokatrov\\---
 -- kk let's begin.
while tool.Selected == false do --we want our victim to keep the tool lol.
    tool.Selected = true
end

x = game.Workspace
player = game.Players.LocalPlayer
tool = script.Parent

print("Loaded.")

tool.Selected:connect(function(m)
    m.KeyDown:connect(function(key)
        print("Key pressed: "..key)
    end)
end)

I made a while loop so the script would automatically check if the tool is unselected, although it doesn't work.

2 answers

Log in to vote
0
Answered by 8 years ago

There is already a property for this. In your tool, go to your properties. Unselect "CanBeDropped." Alternatively, to use it in a script, you can access the property.

local tool = script.Parent
tool.CanBeDropped = false
Ad
Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

If you want to be sure that a tool can never be deselected, first disable the CanBeDropped property.

In a LocalScript, you will need to remove the backpack HUD so the tool can't be manually deselected by clicking on it or pressing a number.

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)

Answer this question