#Scripting Help (Basics)

1 messages · Page 1 of 1 (latest)

pure violet
#

Hi,

Im looking to expand my knowledge of scripting and im needing someone to help me learn/gather the basics of scripting. So that i can eventually create and launch a working game.

Im currently starting off small with creating an obby (Just from the script alone) meaning im not adding parts into workspace, but instead im scripting the parts into workspace.

I have been scripting for about 3 days consistently and i understand certain concepts.

However, im struggling to find an easier option to essentialy clone parts/make a loop for creating killbricks.

Instead im having to create multiple lines of code looking like this (Images provided in the post)

Just wondering if anyone can run me through a solution to essentially clone the parts and explain how it works?

ruby galleon
#

loop through it and add that .touched event

pure violet
ruby galleon
#

vid if he has one

pure violet
pure violet
pure violet
# ruby galleon yep

right i managed to get this far with it now im confused on how to create more killbricks without needing to change the name of all killbricks and then making it so when they are touched the player dies

ebon aspen
#

In the properties of every killbrick you want scroll all the way down until you see tag when you see that add a tag and name it whatever you want, you then can use loop through all the parts that have that one tag

versed flicker
#

use WaitForChild:(“”) in all variables and stuff you use

pure violet
#

im wanting to learn myself, so the script may not look the best. but i can tell u what everything i wrote does

pure violet
versed flicker
#

im as new as u are

ebon aspen
#

@pure violet

pure violet
# versed flicker im as new as u are

i see im just really willing to learn how to script and read my own script so i can eventually make a full game and launch it. Also through being able to read my scripts i can then debug etc.

ebon aspen
pure violet
# ebon aspen

yes i understand that but i mean how would i script it in would i write for example.

killBrick.Tag = "..." ?

#

as i dont have a visible part in workspace until i run the game therefore im going to have to script it in

versed flicker
# ebon aspen

lmao i once had a game that didnt have tags and each killbrick had a script so it would just break my game

versed flicker
#

about tagging

#

im going to bed g

pure violet
keen acornBOT
#

studio** You are now Level 2! **studio

ebon aspen
#
    if v:HasTag('Poop') then
        kill player who touches the part with this tag
    end
end```
pure violet
ebon aspen
#

yessir

ebon aspen
pure violet
ebon aspen
#

ok

pure violet
#

now that ive created a part ive done this to create 4 new parts, but now im struggling to change each parts position without creating each part individually

ebon aspen
#

ok

keen acornBOT
#

studio** You are now Level 6! **studio

pure violet
#

so this is my script for creating the kill bricks ive done a for loop to create 4 bricks

ebon aspen
pure violet
#

but now im struggling to make the bricks have individual positions i dont want the bricks to be in random positions so im not going to use maths.random

pure violet
ebon aspen
pure violet
#

cause when i run the script it is creating 4 different bricks but one inside of the other

ebon aspen
#

have you seen this before

pure violet
#

yea thats to create my tag to the kill the player

#

ignore that part for now

#

this script im showing you is to create new bricks and have different positions

#

but i dont want the positions to be random

ebon aspen
pure violet
ebon aspen
#
  1. math.random 2. replace the numbers of the vector3.new to the letter
versed flicker
#
    if v:HasTag('KillBrick') then
        kb.Touched:Connect(function(hit)
          
    end
end```
#

ew why is it messy

ebon aspen
#

not right now

versed flicker
#

yeah its hard to type on phone

pure violet
ebon aspen
#

yeah

pure violet
#

that would make it anywhere between 1 and 500 on the x

#

but i dont want the position to be random i want it to be in a fixed position

ebon aspen
#

do you wnat them to be randomized but they go in the same direction

#

ok

pure violet
#

but all 4 bricks to be in different positions from one another

#

look ill show you what i mean

versed flicker
#

use a vector3 i think

ebon aspen
pure violet
#

so i need to create a for loop inside of my existing for loop to change the position of each brick?

ebon aspen
#

no

versed flicker
#

no

ebon aspen
#

the for loop you have right now

#

use the I

pure violet
#

yes

ebon aspen
#

in the for loop

#

and add it to X Y or Z

pure violet
#

i = x, y, z do

#

is that what i need to do

#

for i = x, y, z do

end

versed flicker
#

personally id do it like this
Vector3.new(math.random, math.random, math.random)

ebon aspen
versed flicker
pure violet
#

look ill show you what i mean

versed flicker
pure violet
#

when i run my script currently its creating 4 bricks inside of each other

ebon aspen
#

do it my way @pure violet

versed flicker
#

hmm

ebon aspen
#

Accept my friend requst

#

brad

versed flicker
#

yeah do what he did

pure violet
#

but i want the bricks to be seperated from one another but not in random positions i want each brick to have its own fixed position without me needing to create a new brick everytime

#

like this

pure violet
versed flicker
#

like what are you trying to do @pure violet

ruby galleon
#

with all the properties u want

#

and then duplicate that part sround ro where u want ur killbricks

#

actually tags are prolly more efficient dont use this

pure violet
#

All fixed and I learned new things, thanks @ebon aspen

keen acornBOT
#

studio** You are now Level 3! **studio