i have the following code:
function AnimateUI.typeWrite()
player.LocalPlayer.character.PrimaryPart.Anchored = true
end
in a module script, i want the code to anchor my character but it doesnt work because it says that “character” couldnt found. what can i do?
2 Likes
You typed it wrong, it’s player.LocalPlayer.C haracter.PrimaryPart.Anchored
Also btw read this
Hello there, I want to get leaderstats from a ModuleScript but in order to do that I need to get the LocalPlayer but when I do:
repeat wait(1) until game.Players.LocalPlayer
It Doesn’t work.
thanks, but i tried that too, idk why, but when i use “character” by black magic it works.
Even if i use “Character”
do you require it by a local script or normal script?
if you are talking about the conection between a server script and a module script, make sense that it doesnt works.
surprisingly, the module script returns me to perfection the local player, however this time isnt it.
Question: why are you doing player.LocalPlayer ?
it should be either player.Character or game.Players.LocalPlayer depending on what context the script is required
And also, what exactly is player your script?
i have a variable before that called player that makes reference to the local player
NyrionDev
(Nyrion)
September 12, 2023, 7:34pm
#9
What is player
equal to? If player
is equal to game.Players.LocalPlayer
then do:
player.Character.PrimaryPart.Anchored = true
Else if it’s equal to game.Players
do:
player.LocalPlayer.Character.PrimaryPart.Anchored = true
i thought that was pretty obviusly
How about this
function AnimateUI.typeWrite(playerObj)
playerObj.Character.PrimaryPart.Anchored = true
end
in the requiring script, pass a player object
could be a good idea, i will try it
system
(system)
Closed
September 26, 2023, 7:38pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.