Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make my variable update?

Asked by 5 years ago

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?

01inputservice.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()
08                    break
09                end
10            end
11        end
12    end
13end)
0
Are you trying to reassign a variable, or... davibesw 0 — 5y
0
im trying to make it update for when the brick moves it changes the coordinate VykaGaming 7 — 5y
0
you can use while wait() do TheRealPotatoChips 793 — 5y

Answer this question