I have made a tool datastore but the issue I am running into is how can I change the bool value [Lantern] datamodel to true if a player has a lantern in their inventory?? Here is a screenshot of where the datamodel is.
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Backpack = Player.Backpack
if Backpack:FindFirstChild("Lantern") then
Player.OwnedTools.Lantern.Value = true
end
Backpack.ChildAdded:Connect(function(Child)
if Child:IsA("Tool") then
if Child.Name == "Lantern" then
Player.OwnedTools.Lantern.Value = true
end
end
end)
end)
end)
1 Like
Thanks for your help!! This solution worked!!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.