how do i make my variable update?
I try to make a bag which u can pickup but the variable does not update so when the bag moves you cannot pick it up anymore becouse the variable is stuck on 1 coordinate point anyone help with the Mag variable?
01 | inputservice.InputBegan:connect( function (i,g) |
02 | if i.UserInputType = = Enum.UserInputType.Keyboard then |
03 | if i.KeyCode = = Enum.KeyCode.F then |
04 | for _,Door in pairs (workspace.Shops:GetChildren()) do |
05 | local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude |
06 | if Mag < = Door.Range.Value then |
07 | Door.Event:FireServer() |