#Is there a way to detect range in Roblox Scripts
395 messages · Page 1 of 1 (latest)
i googled it several different ways it didnt give me shit
do you know how bad google is nowadays??
use magnitude
ok
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.
yeah thats a 100% true isnt it?
Then how come
every single time ive searched for something
ive found 0% of what i want
Also, what do you mean by "make npc fall over"?
like
Play an animation to make him fall?
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
You want to crunch a npc?
like if you were to fling someone inr 6
Ok.
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
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.
No
Google is just fucking stupid
it used to work better
Lol.
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
[]
** You are now Level 5! **
Found out how to do that?
and it makes it even more complicated because im trying to make it only happn when a stringvalue is 1
No
part.Position
Ok
Position is a property of all parts in the workspace.
How do you calculate the distance between 2 points?
In a 3d space.
function sit() isnt a thing
I would say it isn't.
why is it on the roblox community fourm thng then
Link, please.
sit() is a function that you define.
local function nameOfFunction()
--code here
end
nameOfFunction()
The first part defines a function with a name.
In the function you insert some code you want to run anytime.
But how do i get the humanoid
Then you call the function.
Really depends on how you want to implement the script.
Maybe the player touches a part?
And from there you can just get it.
its not for a player
For what?
PLace the script in the NPC's humanoid.
And use script.Parent
All moving entities have a "humanoid", ideally.
On Roblox.
but
its for a proximityprmpt in an npc
also apparently local isnt a thing anymore /j
Ok explain to me like I was a 5yrs old what you want to accomplish now.
The whole situation.
i want
Oh yeah.
for clarification i did NOT add the character.humanoid.sit
You gotta finish declaring Humanoid.
opk
Just do script.Parent.
And place the script in NPC's humanoid.
Script, not local script.
local Humanoid = script.parent ?
Sure.
......
@tough briar will be happy to xplain everything that's wrong.
I'm playing Bedwars rn.
nah i know someone 10x better than all of you
Guess what
Go to him.
I fucking followed your instructions
So he'll tell you.
Definitely not.
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
You can't expect to understand how to do things right.
AND I AINT GOT JACK SHIT AS AN ANSWER
There are tutorials. Please follow those.
thEY dont help
DevKing.
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
Every tried him?
2018???
You just like to complain.
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
MAgnitude
Mate,
You don't know the basics, I already told you.
Go to learn.
Then come back.
This channel is done for helping
Can't do more than that.
okay that makes my eyes bleed
About what?
but
If something is wrong with my code tell me it is wrong when it is wrong
can still be fixed
NOT fucking 50 MINUTES AFTER
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
that is the code i was given
Look at his variable declarations.
and i was not told it was wrong
Why do you keep putting () and []
I already told you.
in the last question
To stop doing that
Don't blame me when I already helped you in your last question.
WHERE did you fucking say that
You use [] in the case that the object name has spaces or not valid characters on it
Go find it. Last question.
if thats not the case you can just use dot
No
Then don't complain about me not helping you......
Ok
Magnitude
you're not helping now so go away
Correct!
show script
i am trying to make it work when a stringvalue is set to 1
This has already been said. Explain to him first of all how to find the position of a part in the workspace.
i removed it all it suck
skill issue gg
** You are now Level 6! **
no im not
local proximity = script.Parent.ProximityPrompt
local Character = workspace.Citizen
local Humanoid = script.Parent
function sit()
Character.Humanoid.Sit = true
end
proximity.Triggered:Connect(sit)```
Where is the script?
check your output
In the explorer.
^
he doesnt sitting
What
there nothing
Show the explorer.
Inside the game hierarchy
Where is the script located
Thats the info we need
And also check the output to see if theres an error
heres
Might I know why are you declaring an humanoid variable if you are not usiong it
i was told to do that
and declaring the citizen from the workspace instead of script.Parent
He wanted to get the humanoid's position.
That's why.
To check some distance or smth.
because i thought the script was a child of humanoid only not the model as well
script.Parent.Parent
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.
The script is named 'HostageScript' right?
yippee
Did he sit?
He became a ghoul.
just he has no animations
I only see that his legs dissapeared
Are you making a "interceptor" clone?
how do i get a sound to play
Nvm it was not Interceptor the game I'm thinking of.
notoriety
SoundName:Play()
oh is it just
I was thinking of Entry Point.
local <SoundVariableName> = <SoundLocationInsideHierarchy>
yep
how do you get the sound servic
game:GetService("SoundService")
it doesnt play sond
To access a service you always use game:GetService, that's called a "method".
And specify which service
Inside of the brackets.
is this wrong
("SoundService")
entry point is
It's alright.
more story game do thing
it doesnt [play though🙏
But the declaration is not alright.
local <VariableName> = game:GetService("SoundService"):WaitForChild("<SoundName>") <VariableName>:Play()
Ok
Okay imma play basketball
is that all in one thing
no
im confused wht is what
local <VariableName> = game:GetService("SoundService"):WaitForChild("<SoundName>")
<VariableName>:Play()```
Cya
Seems more like a cyka.
Replace every element as required, in his line of code.
?
Good.
but it plays the sound as soon as the game starts
nvm i fixed it
Ok click the sound in the explorer.
i put the play outside of the function
Ok.
i just put the play sound in the sit function
** You are now Level 6! **
will this work
it didnt idk what wrong
What didn't work?
changing the face
Show me the explorer again. The NPC.
here he is
Yes please check the output.
Also,
script.Parent.Parent is wrong.
check the other one
What the hej
stop the game
go view tab
go output
now run the game
and send picture of that output
just this idk if they are anything
we are still on HostageScript right?
befroe the red text theres the name of the script you see it right?
after*
below the red text
theres the script location
ok
How.
how do you get starterplayerscripts
ive come to the conclusion magnitude is not what i wanted
What exactly are you trying to do?
i want to play a sound and gradually increase a stringvalue if the player is within a certain radius of an npc
but magnitude just tells you how far apart they are
GetPartsinBounds, Or increase the sound based on distiance from magnitude
Oi.
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.
OH WAIT
?
there is actually let me find it
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.
no the sound isnt playing all the time
did you guys even read what i said
what did u say
