Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

is it possible to associate a brick with a value ?

Hello, I was wondering if it is possible to associate a value to bricks, I explain myself

let's imagine a pill 1 and 2, and a value on 2 if I remove 1 from my value, the pill disappears and vice versa

is it possible?

2 comments

0

if tonumber(pill.Name) > value.Value then?

0

possibly string.match if it has something besides the number in the name

1 answer

✓ Accepted answer

Yeah, it is possible.

local pill1 = PATH OF PILL (e.g workspace.Model.Pill1)
local pill2 = PATH OF PILL (e.g workspace.Model.Pill2)
local pill3 = PATH OF PILL (e.g workspace.Model.Pill3)
local pill4 = PATH OF PILL (e.g workspace.Model.Pill4)
local pill5 = PATH OF PILL (e.g workspace.Model.Pill5)

local pill_Int1 = toNumber(pill1.Name) - NUMBER
local pill_Int2 = toNumber(pill2.Name) - NUMBER
local pill_Int3 = toNumber(pill3.Name) - NUMBER
local pill_Int4 = toNumber(pill4.Name) - NUMBER
local pill_Int5 = toNumber(pill5.Name) - NUMBER

if pill_Int1 < pill_Int2 then
	pill1:Destroy() -- Bye-bye pill 1
	
if pill_Int2 < pill_Int3 then
	pill1:Destroy() -- Bye-bye pill 2
	
if pill_Int3 < pill_Int4 then
	pill1:Destroy() -- Bye-bye pill 3
	
if pill_Int4 < pill_Int5 then
	pill1:Destroy() -- Bye-bye pill 4
	
if pill_Int5 < 6 then
	pill1:Destroy() -- Bye-bye pill 5

If this still doesn't apply to your question, give me more info so I can understand as I don't get what you are trying to say to me.

Good luck, recanman

4 comments

0

I'd rather associate it with a Number Value objet because in reality , i need 5 pills (sorry for the inaccuracy)

0

I tried a little script based on your proposal but I end up with this: 00:05:30.320 - Workspace.bricks.Script:2: ')' expected near 'script' LINE 1 local pill1 = script.Parent.pill1 (e.g script.Parent.pill1)

0

Problem fixed! works good

0

Thanks. Remember to upvote my answer!

This discussion is preserved as it was. New answers, comments, and votes are closed.