So I’m making a basketball game and I’m trying to reset the Values of the basketball if a player leaves while handling the ball. Part of the function works but this is a snippit of the part that doesn’t work. It prints everything with no errors the only problem is the actual bool and stiring values don’t change. I have a picture of the output below too.
if PlayerInfo[ Player.Name ].Values.Has_Ball then -- Refencing a Stats module i use
for _,Basketball in pairs(game:GetService("CollectionService"):GetTagged("Basketball")) do
local Values = Basketball:WaitForChild("Values")
if Values.BallHandler.Value == Player.Name then
Values.BallHandler.Value = "" ; print(Values.BallHandler.Value)
Values.CanPickup.Value = true ; print(tostring(Values.CanPickup.Value))
Basketball:SetNetworkOwner(nil)
print("BallReset")
end
end
end
wait I just noticed something. it does print out what you wanted the script to print did you forget to change the CanPickup.Value to false? otherwise screenshot the explorer.
Ok So I tried using a while loop to change the value but It still didn’t work so im going to report this in the problems tab in the forum it’s printing but it’s not actually changing
if PlayerInfo[ Player.Name ].Values.Has_Ball then
for _,Basketball in pairs(game:GetService("CollectionService"):GetTagged("Basketball")) do
local Values = Basketball:WaitForChild("Values")
if Values then print("Yes") end
if Values.BallHandler.Value == Player.Name then
repeat Values.BallHandler.Value = "" ; Values.CanPickup.Value = true ; Basketball:SetNetworkOwner(nil)
until Values.BallHandler.Value == "" and Values.CanPickup.Value == true
print(Values.BallHandler.Value..tostring(Values.CanPickup.Value))
print("BallReset")
end
end
end
That’s weird, are you sure they’re not changing? because it should be changing otherwise there would be an error. a BoolValue that’s true should look like this