Change a BoolValue with Script

Heya!
I was on Roblox Studio working on my stuff… And I have a problem, I’ve created a BoolValue for a system and I would like to make a simple script that makes when the tool (witch contains the boolValue) is spawned on the player’s inventory, then wait 45 minutes (2700 seconds) and then, make the BoolValue true.

That’s all! If someone can help me to solve this, that would be great, thanks!

1 Like
-- local script version
local player = game.Players.LocalPlayer
repeat task.wait(1) until player.Backpack:FindFirstChild(nameOfTool)
task.wait(2700)
path.to.your.bool.Value = true
-- server script version
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- add task.spawn() if you have other code later in this script that you need to run
task.spawn(function()
repeat task.wait(1) until player.Backpack:FindFirstChild(nameOfTool)
task.wait(2700)
path.to.your.bool.Value = true
end)
end

Hope this helps :slight_smile:

REVISION: I accidentally put “player:FindFirstChild(nameOfItem)” when it should’ve been player.Backpack:FindFirstChild(nameOfItem) oops!

Thanks, It really helps me a lot!

1 Like

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