#getting the right PlayerToHideFrom

1 messages · Page 1 of 1 (latest)

crisp skiff
#

i'm working on a multiplayer game with doom-style characters, and so far i've managed to attach a BillboardGUI to the player. the problem is that since i want to make it in first-person, the player's own sprite will end up blocking their vision. i figured that i could use the PlayerToHideFrom parameter for this, but i'm not sure how to match the BillboardGUI to the player it's welded to.

dapper birch
dapper birch
crisp skiff
dapper birch
#

I've never mentioned anything about the players visibility

crisp skiff
#

oh sorry

#

i read it wrong

crisp skiff
dapper birch
#

Send the code

crisp skiff
dapper birch
#

You didn't make this did you

crisp skiff
#

i followed a tutorial, yeah

upper siloBOT
#

studio** You are now Level 1! **studio

crisp skiff
#

as i said, new to studio

dapper birch
#

ok give me a sec

#

Are you welding a part to the player?

crisp skiff
#

i used this to weld a part to the player to use as a new collision box, and i figured out that i could attach the billboard to the player using that part

dapper birch
#

billboard ui or a surfaceui?

#

also make the weld part invisible

crisp skiff
#

billboard ui, and the part is already invisible

dapper birch
#

PlayerToHideFrom needs a player as a value

crisp skiff
#

yeah

#

i just gotta get the player

#

while making it work for all players individually

dapper birch
#

So on character added, you can just put BillboardUi.PlayerToHideFrom = PS:GetPlayerFromCharacter(character)

crisp skiff
#

ill try that rq

#

having some trouble getting it to work, would you mind going into one of the vcs so i can stream it?

crisp skiff
tawny thicket
#

You can probably just make that billboard gui your character

#

try replacing the starter character with it

crisp skiff
#

ill try that

tawny thicket
#

put a humanoid in it and turn off requires neck and head

crisp skiff
#

i've created a copy of the game to test this out

upper siloBOT
#

studio** You are now Level 2! **studio

crisp skiff
#

geniunley don't know what im doing, but now the player spawns in normally without anything attached as if it were any other roblox game

tawny thicket
#

in StaterPlayer create a Model and name it "StarterCharacter" that has your billboard gui part in it, and a humanoid in there as well.

#

you might want to rename it to HumanoidRootPart and set the root property of your humanoid

crisp skiff
#

this is what was happening before, but i'll try that now

tawny thicket
#

it should completely override your character creation

crisp skiff
#

is this what you meant?

tawny thicket
#

uh

#

yeah where is your part tho

#

humanoid should be named Humanoid

#

you should have a part to put ur billboard in

crisp skiff
#

let me rearrange things rq

#

is this better?

tawny thicket
#

dont make part a child of the humanoid

#

and rename it to HumanoidRootPart

#

but ye

#

getting better

crisp skiff
#

it works now, but the original problem remains unsolved and now the cylinder used as the collision box is sideways

tawny thicket
#

no worries

#

it'll be easier now

#

in your script in the CharacterAdded one

#

you're gonna want to do character:FindFirstChildWhichIsA("BillboardGui")

#

also the cylinder you're using for collision you can make the Part inside the startercharacter

crisp skiff
#

the cylinder is currently under Humanoid and labelled as 'part'

crisp skiff
tawny thicket
crisp skiff
#

ok

tawny thicket
#

line 15 that's your characteradded funciton

crisp skiff
#

i've done that now

#

it's right under line 19

tawny thicket
#

local function characterAdded(character, player)
  local billboard = character:FindFirstChildWhichIsA("BillboardGui", true)
  billboard.HideFromPlayer = player
end

local function playerAdded(player)
  player.CharacterAdded:Connect(function(character)
    characterAdded(character, player)
  end)
  if player.Character then
    characterAdded(player.Character, player)
  end
end

Players.PlayerAdded:Connect(playerAdded)
for _,v in Players:GetPlayers() do
  playerAdded(v)
end
crisp skiff
#

should i put that in a new script or the existing one?

tawny thicket
#

existing one

crisp skiff
#

nothing seems to have changed

tawny thicket
#

PlayerToHideFrom

#

my bad

#

I got the property wrong

#

just change that and ur good

crisp skiff
#

ok

upper siloBOT
#

studio** You are now Level 3! **studio

crisp skiff
#

on this line, yeah?

tawny thicket
#

ye

crisp skiff
#

nothing's changed, and the PlayerToHideFrom is left blank

tawny thicket
#

looks like you never defined Players?

#

did u just add this entirely

crisp skiff
#

yes, i did

tawny thicket
#

add local Players = game:GetService("Players") to the very top of the script

crisp skiff
#

ah ok

#

sorry, i'm a beginner

#

that worked! thank you so much!!

tawny thicket
#

try to understand why i'm asking you to do that

#

notice how Players is underlined

crisp skiff
#

yeah

#

it was already defined in an earlier line but it was names PS instead of Players

tawny thicket
#

that means there's a problem with it, if u mouse over it'll give you more info

#

it probably would say that Players is undefined in the current scope

#

which means u need to define it

#

ah gotcha

crisp skiff
#

what i did is just replace the two instances of Players with PS and it worked properly

tawny thicket
#

sure