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

Is it possible to do math with a path?

Asked by 10 years ago

I will use three buttons as an example This script is very rough but I want to know if It's possible to do math with path values of some sort.

I am trying to use paths instead of numbers.

PathA = PathA + PathB
PathA = PathA - PathB
PathA = PathA * PathB
PathA = PathA / PathB
PathA = PathA <=PathB

Note: I am not trying to fix a script I want to know if this method is possible and if it will work correctly.

I know the script does not work.

--Rough Example

local ButtonHolder = script.Parent
local pathA = ButtonHolder.ButtonAHolder.ButtonA
local pathB = ButtonHolder.ButtonBHolder.ButtonB
local PathNameA = ButtonHolder.ButtonAHolder
local PathNameB = ButtonHolder.ButtonBHolder

local Subtract = ButtonHolder.Subtract


Subtract.MouseButton1Down function()) 
pathA.Value = PathA.Value - PathB.Value  --Subtracting a path value

end)
1
What is a "path"? BlueTaslem 18071 — 10y
1
I'm with BlueTaslem on this one. The question uses....custom...terminology? I guess. Best term I can think of. MrNicNac 855 — 10y
0
Nevermind I figured out how to do it. A.Value = (A.Value-B.Value) IntellectualBeing 430 — 10y

1 answer

Log in to vote
0
Answered by
OniiCh_n 410 Moderation Voter
10 years ago

As long as it's an IntValue and the value is not nil then it should work. Your rough example seems confusing though.

I'm assuming you mean path as in game.Workspace.yadayada

Ad

Answer this question