#how do i convince roblox studio that PlayerScripts is infact a child/member of the player?
151 messages · Page 1 of 1 (latest)
Bro what
If you're doing this from the server, then it's because Player scripts are only replicated on the client
dude i know this
even on client it doesnt work
im aint stupid
Yeah
if i didint try anything i wouldnt come here
so basicaly i need to disable a script untill the character spawns in (aka clicks a button on the character selection screen) and when i try to make a path to the script (EVEN ON A LOCAL SCRIPT) the output says that Playerscripts ISNT REAL
Show me the code where you're trying to get the object
Why not just make it a character script?
what
dude you understand that Player and character script are diffirent things
You're saying you need it to be disabled until the character spawns
well or Enable when he spawns
But just once
also heres the function
function SpawnIn(plr: Player)
if selectedChar then
spawnRE:FireServer(selectedChar)
plr.PlayerScripts:WaitForChild("Client").Enabled = true
if camera:FindFirstChild("SELECTED CHARACTER") then
camera["SELECTED CHARACTER"]:Destroy()
end
camera.CameraType = Enum.CameraType.Scriptable
gui:Destroy()
end
end```
no not realy
Is the plr parameter the local player
Or another client
it still fetches the player THAT HAS THE PLAYERSCRIPTS IN THE EXPLORER
RAAAAAAAAA
What
I'm asking you if this function is only intended to work for the local player @narrow granite
yes it is supposed to work for the local boi
Or if you're trying to access the Player scripts of another player that's not the local client
the player himselv
noep
like?
waitforchild for PlayerScripts?
good one but i already tried it
whole local script commin up
Could it be that you might not be passing a player as an argument
you mean scope?
so
ah foqe
bruh
how do you expect
to get the player here
where anywhere would the player come from as an argument
so add an extra argument?
wait no
add the argument in the SpawnIn fucntion at the end or smth?
MouseButton1Click gives you the x and y coordinate
nowhere does it get you the player lmao
ok mane im kinda tired (idk why) so i dont really understand what ur saying rn
ok
Can I ?
you know how functions work right
Explain ?
can I try rq
Yessir
but sure
yeah
yup
alright
i call them scopes 
is there something wrong with me?
ok yeah there is
Right now, you're expecting the MouseButton1Click function to give you the player
which is not true
yeah but i tried to trigger that function fia button click
@true aurora you can explain lol idk hiw to to explain this
but why do you think you would get the player as an argument
Alright
what you need to do is make a variable for the player
kind of
And do you know how events work ?
yeah
but in the hints it said when the GUI button is clicked with M1 btw
Alright so when there is an event in the game you can some infos right ?
For example
Players.PlayerAdded => Event : a player is Added => you get the player who is added
Do you get that ?
yeah i kind of knew that from the getgo but how do i make it so the script enables when the player is in the map/clicked the spawn button
I'm going into it
So basically some events give you informations, other dont
For example, child added gives you the child that has been added
But for mouse button 1 click
OH WAIT
WAIT A SEC
yeah
so i gotta like
Workspace.ChildAdded--...--wait a second
``` uhhhh
how do i specify which Child is added?
wait this is one of these things that are far more complex isnt it?
ok whew
Instance:WaitForChild("name")
or
If you want to do something whenever any child is added to an instance:
kind of tried
Instance.ChildAdded:Connect(function(child: Instance)
print(child.Name)
end)
DUDE I JUST THOUGHT OF THIS
This will run whenever a new child is added to the instance
RIGHT BEFORE YOU SHOWED IT TO ME
Can I show you rq what you expect to happen with your SpawnIn() function
eh ok
local function SpawnIn(plr: Player) -- the ":" is just a type annotation, it doesn't mean you'll actually get a Player object
print(plr.PlayerScripts) -- would work, *if the plr was a player*, but it's not
end
--mimicking what happens when you connect "SpawnIn" to "MouseButton1Click"
SpawnIn(1,2) -- first parameter is the x coordinate the button was clicked at, the second is the y
--You're trying to change a number into a player, which doesn't work AT ALL
^
Events might seem a bit mysterious, but really when you :Connect() a function, it just adds it to a list of functions that are called whenever the event is fired
wait the roblox AI was cooking
what
dude i almost got the awnser
the AI coding thing gave a hint for the function to find the Player
...
you literally just do
local plr = game.Players.LocalPlayer
na not that
wait its not hte same player i need tho? or it is
bruh
you said it should only work for the local player
sorry mate my brain is quite deepfried, im still standing with the power of determination
wait i was cooking with this
if child.ClassName == "Model"?
LADIES AND GENTLEMEN THE AI COOKED
(it copied and pasted some parts of this script here tho)
holly shit it worked
the roblox autocode ai worked
LETS GOOOOOO
why didnt u just use character added, executed the code and repeat wait() until character is not nil or whatever and disabled it. but its doesnt matter now that you solved it.