Cool! By the way, you don’t have to use pcalls for checking for potentially nil parts:
pcall fixes
RemainingTries = 5
while RemainingTries > 0 do
success = pcall (function()
char = player.Character
HRP = char:FindFirstChild("HumanoidRootPart")
end)
-- Break the loop early if the player's character is found without errors.
if success and char then
RemainingTries = 0
break
end
task.wait(0.075)
end
^^ this can be shortened to vv
while RemainingTries > 0 do
HRP = player and player.Character and player.Character:FindFirstChild("HumanoidRootPart") -- This pretty much means if player, and if player.Character, then if player.Character:FindFirstChild("HumanoidRootPart") then return it
-- Break the loop early if the player's character is found without errors.
if HRP then
RemainingTries = 0
break
end
task.wait(0.075)
end
That’s a good tip! What happens if it finds the player’s character but doesn’t find their HumanoidRootPart, though? Does it return the Character or just nil?
I’ve updated the function to use my experience’s CharacterStorage “system”, so that code’s now pretty much completely different now. This advice/tip could be useful for CharacterStorage, though, since that “system” tries to quickly get references to character models, body parts, and other instances many times. I don’t know if that script uses a pcall, though.
-- RemainingTries = 5
if player:GetAttribute("CharacterGUID") then
entry = CharStorage:GetDictionary(player:GetAttribute("CharacterGUID"), false)
if entry then
-- Is this Player within the requested number of studs of the door? They're in the way if that's the case! Break the loop here.
if entry.Character and entry.Humanoid.RootPart and (entry.Humanoid.RootPart.Position-_reference).Magnitude <= _radius then
IsClose = true
break
end
else print("IsCharacterNear:", player.Name, "doesn't have a CharacterStorage entry yet. Skipping!")
end
else print("IsCharacterNear:", player.Name, "hasn't been given a GUID yet. Skipping!")
end
It is really helpful to make a design for a webpage. It’s free, there are enough tutorials online to watch to understand Figma. You can use it in a browser or just in their desktop app!
After I added that “safety precaution” feature to the door on the counter, I decided to work on the rest of the restaurant a bit. I’ve mainly just added a couple new walls, changed their texture size to actually fit their apparently 11-stud height. (Is that a good height for public places’ rooms? They’re usually like twice the height of a human.)
…but there’s another addition; Thanks to @stravant’s model mirroring/reflecting plugin, I could easily clone the left-side entrance to make its mirrored counterpart on the right side! (I’m amazed that it even cloned and properly corrected the doors’ attachment references, too.) Here’s a couple pictures of how it all looks, though these were taken while it was raining.
Oh, and now there’s also a small light above each entrance, mainly there to add that extra bit of mood when you’re standing outside the restaurant at night, as shown in this picture.
Tediously adding parts to all 49 keys of my skinned keyboard mesh. Why am I doing this? Well, I’d like it to be playable in VR, even if you’ll only be able to press one key with each hand.