Meat_Make
(Meat Make)
June 2, 2023, 8:20pm
#1
This is my code:
And this is the error I get:
How can this be? I used a :WaitForChild function for the character and ontop of that used a CharacterAdded function. Why can’t I get the character in the local script? On a server-sided script, it works just fine!
try this:
local char = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
Hello, CharacterAdded has a special parameter for your need:
CharacterAdded:Connect(function(Character)
Option 1:
You can use:
local Character = Player.Character or Player.CharacterAdded:Wait()
this gets the character of the specific player and if it hasn’t loaded yet it will wait until it does.
Option 2:
You can used a CharacterAdded
event like so:
Player.CharacterAdded:Connect(function(Character)
...
end)
this will fire code within the connected function once the specific player’s character has been added into the game.
3 Likes
system
(system)
Closed
June 16, 2023, 11:16pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.