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

How do I make a tool incapable of being selected for an amount of time?{Solved. Thanks!}

Asked by 10 years ago

How would I make it so that for 30 seconds, a tool couldn't be selected, then for 45 seconds, the tool could be selected, in a never ending loop? Thanks!

2 answers

Log in to vote
1
Answered by 10 years ago

If you don't want the tool visible in the backpack, just keep the tool in the lighting, then have the script move the tool into the backpack after a specific amount of time has passed. Like so:

--PUT THIS SCRIPT IN THE PLAYER

wait(30) --Waits 30 seconds
local Tool = Lighting["PUT TOOL NAME HERE"]:Clone() --Clones the tool
Tool.Parent = Player.Backpack --Puts the tool in the backpack of Player
wait(45) --Waits 45 seconds
Tool:Destroy() --Removes the tool

However, if you want the tool to be visible in the backpack, you would have a value in the tool called "CanSelect" or something like that, and have the equipped function of the tool check to see if that value is true, and if it isn't, then it deselects the tool. Like so:

--PUT THIS SCRIPT IN THE TOOL

local Player = game.Players.LocalPlayer --This gets the player that the script is in
function onEquipped()
    if (not Tool.CanSelect.Value) then
        Player.Character.Humanoid:UnequipTools()
        break
    end
    --Code here
end

You can have an external script change the value of "CanSelect" after a set time

0
Where would I put the script on top? nightmare13542 45 — 10y
0
Why lighting? Tesouro 407 — 10y
0
Just put it in workspace I believe. But what is "Player" in the Player.Backpack? Tempestatem 884 — 10y
0
I edited the question TurboFusion 1821 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Is it in a Gui? If it is, I could help you out.

Put this script in the Gui.

Put the tool in Lighting.

while true do

if script.Parent.MouseButton1Click then
game.Lighting.TOOLNAME:clone().Parent = backpack
end
    script.Parent.Visible = false
    wait(45)
    script.Parent.Visible = true
    wait(30)
    script.Parent.Visible = false
    wait(45)
end
0
I have a GUI shop, but the tool itself would be in the players backpack. nightmare13542 45 — 10y

Answer this question