Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would one go about making client npc rendering?

Asked by
IDKBlox 349 Moderation Voter
4 years ago
Edited 4 years ago

What I'm attempting to achieve is spawning NPCs (probably on the client) but only being able to see so many around you. I have things already where I can get the look of said NPC; All I need to know is how I would make some show and others not (until needed) If this doesn't make sense, please feel free to ask questions! I'd really appreciate the help.

Edit: I'm sorry if people feel this is against the rules. I'm just not sure how else to get this information. I have checked this site, I have checked the forums and I have googled it. I just want further information to help me accomplish my goal. If this is against the rules then I'd like to know where I can get a more helpful website that won't judge me because I don't know something and I am trying to get more information. Thank you

3 answers

Log in to vote
1
Answered by
Infocus 144
4 years ago

Please refer to my comment on your post. Im not sure if this is allowed as I'm not really posting a solution, but this may be helpful.

Check the radius around your character to check for NPCs using Region3 or magnitude. If the amount is greater than x (your cap amount of npcs) then parent the furthest ones to nil. You can check the distance with magnitude. You would have to constantly fire or check though I believe, but this is just my 2 cents. Cheers

0
--Replying to your comment on scoop's post regarding nil::::: Well its not that simple, this is also assuming they keep their positions when they were parented to nil, but if they don't, then just save their position and reposition when you're near them. Infocus 144 — 4y
0
Honestly I'm not sure if it will make a difference with performance but either way. It is an answer and I will give it a shot! Thank you for much! If interested, I'll let you know what I find out with it! Thank you! IDKBlox 349 — 4y
0
Sure, I'd like to know if my solution was correct as it helps me unrust my brain. Glad to help Infocus 144 — 4y
0
Oh awesome! I'll check that out. Thanks! Yeah for certain, I'll let you know! (It'll most likely be tomorrow lol) IDKBlox 349 — 4y
Ad
Log in to vote
0
Answered by
b2lego 30
4 years ago

Try using the .Magnitude property by subtracting the npc's position (assuming the npc is stationary) and the player's head.

if (npc.Position - Player.Character.Head.Position).Magnitude > desiredRenderDistance then
    npc.Transparency = 1
else
    npc.Transparency = 0
end

If you have that script run constantly, the code should always be checking if the distance between the you [the player] and the npc is too far thus making it invisible. If you dont want it to even show up I believe you set the parent to nil like infocus said. Good luck! Hope this works!

0
Thanks! I will look into this! I get where you are coming from using magnitude to determine if I should have the npc Visible or not. Like Infocus's post, I don't know if that would make a performance difference; Either way I really appreciate your answer! IDKBlox 349 — 4y
0
As for performance, I don't think it would make a difference because it has already loaded in and the computer will still be tracking it whether or not it's present. But I could be wrong. Also no problem! I'm still getting used to Roblox Studio so I'm glad to have helped! b2lego 30 — 4y
Log in to vote
-1
Answered by
Lakodex 711 Moderation Voter
4 years ago
Edited 4 years ago

This is not an ASKING WEBSITE. Its against the Community Guidelines to give an answer with a question. Its in Website Guidelines area in Community Guidelines and line 2. I see you have 295 reputation and you should already know this! Please do not post another one like this or you can have a chance of being banned for Mass guideline breaking

0
I'm asking for information to help me achieve my goal. If I get banned for requesting information to help me achieve said goal. Then I'd like to get banned. I'm not asking for anyone to give me a script. I'm asking for further information about this topic. Thank you. IDKBlox 349 — 4y
0
Could you please explain to me how I am going against community guidelines? IDKBlox 349 — 4y
0
As I said. Look at Website Guildelines in community guidelines. It says "Do not post requests for scripts, building, or making a game." Lakodex 711 — 4y
2
I'd have to disagree. It shouldn't be taken soo literally, this man is clearly knowledgeable in the field, but is stuck and needs guidance. Infocus 144 — 4y
View all comments (6 more)
0
I've looked at the guidelines. This is not a request for a script, build nor an entire game. I just asked for more info and rendering Client Npcs because I don't even know where to being with them. Thank you @InFocus I really appreciate that. If I worded things wrong then I'd really like to know how I can word it better. Thanks IDKBlox 349 — 4y
0
Maybe you can check if x NPCs are around you, then simply parent the others to nil. I forget, but I think you'd want to check using magnitude or Region3. I would give an example, but I haven't scripted in years. Infocus 144 — 4y
0
There are quite a lot of parameters here. Infocus 144 — 4y
0
scoop, I've seen you around on other people's post as though you were a moderator or police. Im sure that when the creators of this website made the rules, they didn't intend for each rule to be taken literally word for word. b2lego 30 — 4y
0
You think just parenting them to nil will do it? I actually thought of that, I'm just not sure that'll actually make a performance difference. But then again, I'm not completely sure. Which is the reason for the post lol IDKBlox 349 — 4y
0
They meant for the rules not to be broken. and No, I'm not a moderator. BUT I can request moderation for rules being broken. Lakodex 711 — 4y

Answer this question