#Is there a way to detect range in Roblox Scripts

395 messages · Page 1 of 1 (latest)

tough briar
#

google

quaint hull
#

do you know how bad google is nowadays??

charred steppe
#

use magnitude

quaint hull
kind slate
#

Lmfao.

#

You find 90% of the shit you need by searching "Roblox studio [insert what you need]".

#

For example "Roblox Studio play sound"

#

"Roblox Studio calculate distance"

#

And whatever you wish to do.

quaint hull
kind slate
#

That's why I said 90%. 😄

quaint hull
#

Then how come

#

every single time ive searched for something

#

ive found 0% of what i want

kind slate
#

Also, what do you mean by "make npc fall over"?

quaint hull
#

like

kind slate
#

Play an animation to make him fall?

quaint hull
#

no like

#

you know like if a roblox character were like

#

crushed under a block or sometihng

#

and they kinda just like idk

#

they go stiff and fall over

kind slate
#

You want to crunch a npc?

quaint hull
#

like if you were to fling someone inr 6

quaint hull
#

let me try and get an image example

kind slate
#

Ok.

quaint hull
#

or i could make them sit down

#

how do i make them sit

kind slate
quaint hull
#

how come when i google it i odnt get shit

#

you literally have to be extremely specific and use the exact right words or you dont get what you want

kind slate
#

You google wrong stuff.

#

You gotta remove useless words.

#

As you can see I didn't say "how do I make a npc sit"

#

just "make npc sit"

#

Keep it simple.

quaint hull
#

Google is just fucking stupid

#

it used to work better

kind slate
#

Lol.

quaint hull
#

you didnt use to have to have extremely specific searches

#

you could even make like tons of typos and it sometimes would still get it

#

anyway this whole thread was about detecting range not sitting down

kind slate
#

[]

brazen lilyBOT
#

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

kind slate
#

Found out how to do that?

quaint hull
#

No

#

or i think idk

#

but none of the options worked

kind slate
#

Know how to find the position of a part?

#

In workspace.

quaint hull
#

and it makes it even more complicated because im trying to make it only happn when a stringvalue is 1

quaint hull
kind slate
#

part.Position

quaint hull
#

Ok

kind slate
#

Position is a property of all parts in the workspace.

#

How do you calculate the distance between 2 points?

#

In a 3d space.

quaint hull
#

function sit() isnt a thing

kind slate
#

I would say it isn't.

quaint hull
#

why is it on the roblox community fourm thng then

kind slate
#

Link, please.

quaint hull
kind slate
#

sit() is a function that you define.

#

local function nameOfFunction()
--code here
end

nameOfFunction()

kind slate
#

In the function you insert some code you want to run anytime.

quaint hull
#

But how do i get the humanoid

kind slate
#

Then you call the function.

kind slate
#

Maybe the player touches a part?

#

And from there you can just get it.

quaint hull
#

its not for a player

kind slate
#

For what?

quaint hull
#

im making an NPC sit

#

??????

kind slate
#

PLace the script in the NPC's humanoid.

#

And use script.Parent

#

All moving entities have a "humanoid", ideally.

#

On Roblox.

quaint hull
#

but

#

its for a proximityprmpt in an npc

#

also apparently local isnt a thing anymore /j

kind slate
#

Ok explain to me like I was a 5yrs old what you want to accomplish now.

quaint hull
kind slate
#

The whole situation.

quaint hull
#

i want

kind slate
#

There is an error somewhere.

quaint hull
kind slate
#

Oh yeah.

quaint hull
#

for clarification i did NOT add the character.humanoid.sit

kind slate
#

You gotta finish declaring Humanoid.

quaint hull
#

oh wait yeah

#

how do i declare humanoid

kind slate
#

Don't.

#

Actually.

quaint hull
#

opk

kind slate
#

Just do script.Parent.

#

And place the script in NPC's humanoid.

#

Script, not local script.

quaint hull
#

local Humanoid = script.parent ?

kind slate
#

Sure.

quaint hull
#

script does not work at all

kind slate
#

......

#

@tough briar will be happy to xplain everything that's wrong.

#

I'm playing Bedwars rn.

quaint hull
#

nah i know someone 10x better than all of you

kind slate
#

Lol.

#

Mate you got everything wrong in that script.

quaint hull
#

Guess what

kind slate
#

Go to him.

quaint hull
#

I fucking followed your instructions

kind slate
#

So he'll tell you.

kind slate
quaint hull
#

definitely did

#

you barely even told me to do anything anyway

#

you literally just said "find this" and "change humanoid to script.parent" and left it at that

kind slate
#

Mate.

#

You don't know basic Lua...

#

You need to start from the basics.

quaint hull
#

I have literally asks 503819 FUCKING TIMES IN GENERAL

#

HOW TO LEARN

kind slate
#

You can't expect to understand how to do things right.

quaint hull
#

AND I AINT GOT JACK SHIT AS AN ANSWER

kind slate
#

There are tutorials. Please follow those.

quaint hull
#

thEY dont help

kind slate
#

DevKing.

quaint hull
#

im listening to someone talk about some obvious bs that i already know how to fucking do for 20 minutes before they get to the code

kind slate
#

Every tried him?

quaint hull
#

2018???

kind slate
#

Still good.

#

Stick with him.

#

Basic tutorial.

quaint hull
#

dude

#

my FUCKING EARS hurt

kind slate
#

You just like to complain.

quaint hull
#

no

#

you're just a piece of shit

#

why tell me at one point code is wrong yet another tell me its not

#

if it was WRONG

#

TELL ME IN THE FIRST PLACE

civic cedar
#

MAgnitude

kind slate
#

You don't know the basics, I already told you.

#

Go to learn.

#

Then come back.

civic cedar
kind slate
#

Can't do more than that.

civic cedar
#

he asked for help with something

#

we help him

kind slate
#

I'm not here to tutor.

#

Look at his code.

quaint hull
#

you

#

Lied

civic cedar
#

okay that makes my eyes bleed

kind slate
#

About what?

civic cedar
#

but

quaint hull
#

If something is wrong with my code tell me it is wrong when it is wrong

civic cedar
#

can still be fixed

quaint hull
#

NOT fucking 50 MINUTES AFTER

civic cedar
# quaint hull

when you are calling a function you do not use the function keyword again

#

just type the function name with the ()

#

in case it has parameters then you type them inside the brackets

#

lmk if that works

#

I'll gtg pretty soon tho

quaint hull
#

that is the code i was given

kind slate
#

Look at his variable declarations.

quaint hull
#

and i was not told it was wrong

kind slate
#

Why do you keep putting () and []

#

I already told you.

#

in the last question

#

To stop doing that

quaint hull
#

that first line was

#

written ages ago

kind slate
#

You didn't listen.

#

Then fix it.

quaint hull
#

where di you fucking say that

#

its already FIXED

kind slate
#

Don't blame me when I already helped you in your last question.

quaint hull
#

WHERE did you fucking say that

civic cedar
kind slate
civic cedar
#

if thats not the case you can just use dot

quaint hull
kind slate
#

Then don't complain about me not helping you......

kind slate
#

I did help you.

#

Your ears are closed.

pallid raft
#

Magnitude

quaint hull
civic cedar
kind slate
#

Good luck.

quaint hull
#

it not work

pallid raft
quaint hull
#

i am trying to make it work when a stringvalue is set to 1

kind slate
# pallid raft Magnitude

This has already been said. Explain to him first of all how to find the position of a part in the workspace.

quaint hull
pallid raft
quaint hull
#

this is all i have now

#

idk how to find things in starterp

brazen lilyBOT
#

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

civic cedar
#
local proximity = script.Parent.ProximityPrompt
local Character = workspace.Citizen
local Humanoid = script.Parent

function sit()
  Character.Humanoid.Sit = true
end

proximity.Triggered:Connect(sit)```
quaint hull
#

O

#

it didnt ork

kind slate
#

Where is the script?

civic cedar
#

check your output

kind slate
#

In the explorer.

civic cedar
#

^

quaint hull
#

he doesnt sitting

kind slate
#

What

quaint hull
kind slate
#

Show the explorer.

quaint hull
#

oh

#

the explorer

#

i was lookming athte f9 thing

civic cedar
#

Where is the script located

#

Thats the info we need

#

And also check the output to see if theres an error

quaint hull
civic cedar
#

Might I know why are you declaring an humanoid variable if you are not usiong it

quaint hull
#

i was told to do that

civic cedar
#

and declaring the citizen from the workspace instead of script.Parent

kind slate
#

That's why.

#

To check some distance or smth.

civic cedar
#

You use Hrp for that

#

Not humanoid

quaint hull
kind slate
#

Also,

#

The proximity prompt

#

Needs to be placed properly.

#

According to the script.

#

So it would be script.Parent.Parent.ProximityPrompt

#

If we don't want to move it.

#

Or we move the script under Citizen, so it becomes a first child.

civic cedar
quaint hull
#

no way

#

hes floor🙏

#

tahnk you

#

woah the disrespect someone just climbed on him

civic cedar
#

yippee

kind slate
#

Did he sit?

quaint hull
#

kind of

#

he is sitting

kind slate
#

He became a ghoul.

quaint hull
#

just he has no animations

civic cedar
#

I only see that his legs dissapeared

quaint hull
#

his legs are there

#

just in the floor

civic cedar
#

if thats fine for you then yippee

#

we did it chat

kind slate
#

Are you making a "interceptor" clone?

quaint hull
#

how do i get a sound to play

kind slate
#

Nvm it was not Interceptor the game I'm thinking of.

quaint hull
#

or no

#

i mean how declare

quaint hull
kind slate
quaint hull
#

oh is it just

kind slate
#

Place the sound in sound service

#

And reference it properly.

kind slate
civic cedar
kind slate
#

Without the <>.

#

Ofc.

civic cedar
#

yep

quaint hull
#

how do you get the sound servic

civic cedar
quaint hull
#

it doesnt play sond

kind slate
#

To access a service you always use game:GetService, that's called a "method".

#

And specify which service

#

Inside of the brackets.

quaint hull
#

is this wrong

kind slate
#

("SoundService")

quaint hull
kind slate
quaint hull
#

more story game do thing

quaint hull
kind slate
#

But the declaration is not alright.

civic cedar
quaint hull
#

Ok

civic cedar
#

Okay imma play basketball

civic cedar
#

Cyqa

#

Gl with ur gam

civic cedar
kind slate
#

Lol.

#

Bye.

quaint hull
#

im confused wht is what

civic cedar
#

local <VariableName> = game:GetService("SoundService"):WaitForChild("<SoundName>") 
<VariableName>:Play()```
#

Cya

kind slate
kind slate
quaint hull
#

i am not

#

cyka

kind slate
#

?

quaint hull
kind slate
#

Good.

quaint hull
#

but it plays the sound as soon as the game starts

kind slate
#

Go down now.

#

Show me all the script.

quaint hull
#

nvm i fixed it

kind slate
#

Ok click the sound in the explorer.

quaint hull
#

i put the play outside of the function

kind slate
#

Ok.

quaint hull
#

i just put the play sound in the sit function

brazen lilyBOT
#

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

quaint hull
#

386685678

#

whta you saying

kind slate
#

Nice.

#

Does it work well now?

quaint hull
#

will this work

kind slate
#

Probably yeah.

#

Seems good.

#

Try it out.

quaint hull
#

it didnt idk what wrong

kind slate
#

What didn't work?

quaint hull
#

changing the face

kind slate
#

Show me the explorer again. The NPC.

civic cedar
#

always check the output

#

apparently I got some more time

#

before the match

quaint hull
#

here he is

kind slate
#

Yes please check the output.

quaint hull
kind slate
#

Also,

civic cedar
#

ot that output

#

I mean it also works

#

but

kind slate
#

script.Parent.Parent is wrong.

civic cedar
#

check the other one

quaint hull
#

What the hej

quaint hull
#

this is client

civic cedar
#

stop the game

#

go view tab

#

go output

#

now run the game

#

and send picture of that output

quaint hull
#

nothing on output

#

wait nvm

#

idk if this is anytihng

civic cedar
#

any other errors?

#

more than those?

quaint hull
#

just this idk if they are anything

civic cedar
quaint hull
#

yeah

#

trying to change the face

civic cedar
#

befroe the red text theres the name of the script you see it right?

#

after*

#

below the red text

#

theres the script location

quaint hull
#

oh wit

#

nvm

#

the id was wrong

civic cedar
#

ok

quaint hull
#

i swear i copied the correct id but ig i didnt

#

what is this bruh

kind slate
#

How.

kind slate
#

😆

quaint hull
#

how do you get starterplayerscripts

quaint hull
#

ive come to the conclusion magnitude is not what i wanted

mossy wraith
#

What exactly are you trying to do?

quaint hull
#

but magnitude just tells you how far apart they are

mossy wraith
#

GetPartsinBounds, Or increase the sound based on distiance from magnitude

kind slate
#

Isn't there a built-in object for that?

#

No need to do it manually if I remember right.

#

Although I am not a Roblox sound expert.

mossy wraith
#

OH WAIT

kind slate
#

?

mossy wraith
#

there is actually let me find it

kind slate
#

If I remember right it's just a tick you can select.

#

TO make the volume equal in an area or based off the distance from the listener.

quaint hull
#

did you guys even read what i said

tough briar