#help with scripting

76 messages · Page 1 of 1 (latest)

nimble kernel
#

Send cofe

#

Code

stone salmon
#

local part1 = workspace.Part
local part2 = workspace.walls.wall
part1.Touched:Connect(function(hit)
if hit.Parent.Name == part2.Name then
print("hi")
end
end)

#

thats not the code but its an example(almost the same)

nimble kernel
#

Why cant you send the actual code

stone salmon
#

beacuse i deleted it

nimble kernel
#

What

stone salmon
#

when the block hit something its not printing the hi

nimble kernel
stone salmon
#

nope still dont printing

cold marlin
#

Omg stop creating posts with the same issue... @stone salmon

stone salmon
#

thats not the same lol

#

and please leave

cold marlin
#

No, you

stone salmon
#

ah i just blocked him but are you here @nimble kernel ?

frozen smelt
stone salmon
#

no

#

igtg il be back in 20 min

stone salmon
#

im back

plush wigeon
#

what are you trying to do with the script

stone salmon
#

to make it that it the part 1 touch\hit part 2 it will print hi

nimble kernel
#

Just do if hit == part2

stone salmon
#

im new to lua so do i put it like thisbigbrain

carmine pikeBOT
#

studio** You are now Level 5! **studio

stone salmon
#

local part1 = workspace.Part
local part2 = workspace.walls.wall
part1.Touched:Connect(function(hit)
if hit == part2
print("hi")
end
end
end)

plush wigeon
#

if part 1 touches part 2 it prints?

#
part1.Touched:Connect(function(hit)
  if hit == part2 then print("hit") end
end)
stone salmon
#

its giving an error

plush wigeon
#

show

stone salmon
nimble kernel
#

It literally tells you

#

Line 6 parentheses

stone salmon
#

i fixed it but even now its not working

nimble kernel
#

To close off function

#

Are you sure youre getting the right part?

stone salmon
#

yeah

#

wait

#

how dod you done the code text?

plush wigeon
stone salmon
#

half of this is chatgpt but its finee

nimble kernel
#

chatgpt 💀

stone salmon
#

maybe the block movement doing something that dont let it hit the other block

plush wigeon
#

coroutine???

#

damn

nimble kernel
#

Yeah

#

Thats it

#

Youre setting the position directly

stone salmon
#

so what do i do

nimble kernel
#

So it wont activate the touched event

plush wigeon
#

you have to do xyz math

nimble kernel
#

Use linearvelocity

plush wigeon
#

or use workspace:getpartsinpart

#

or that idk

nimble kernel
#

Or that

stone salmon
#

yeah but how do i use linearvelocity in the code

#

(:

nimble kernel
#

Unanchor the part and make an attachment then set the vectorvelocity to the current direction

plush wigeon
#

wouldnt it fall

#

gravity

nimble kernel
#

Yes

plush wigeon
#

and the fact that players can push it around

cold marlin
stone salmon
#

what did he said?

stone salmon
plush wigeon
#

still they can give force

#

Also what do you want to use the part 1 touched thing for

#

to move back?

stone salmon
#

i want it that if the block touch a wall it will reset some things

stone salmon