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 4 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?

inputservice.InputBegan:connect(function(i,g)
    if i.UserInputType == Enum.UserInputType.Keyboard then
        if i.KeyCode == Enum.KeyCode.F then
            for _,Door in pairs(workspace.Shops:GetChildren()) do
                local Mag = (Door.Center.Position-game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude
                if Mag <= Door.Range.Value then
                    Door.Event:FireServer()
                    break
                end
            end
        end
    end
end)
0
Are you trying to reassign a variable, or... davibesw 0 — 4y
0
im trying to make it update for when the brick moves it changes the coordinate VykaGaming 7 — 4y
0
you can use while wait() do TheRealPotatoChips 793 — 4y

Answer this question