This script works in regular studio testing mode, but not ingame. Any help? I'm getting the error ScreenGui is not a valid member of PlayerGui on line 6.
script.Parent.Hitbox.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if hit.Parent:FindFirstChildWhichIsA("Humanoid") ~= nil then if player.CarryingB.Value == false then player.CarryingB.Value = true player.PlayerGui.ScreenGui.Battery:TweenPosition(UDim2.new(0.85, 0, 0, 0), "Out", "Sine", 1) script.Parent:Destroy() end end end)