I want to have it so when a player joins I change there head transparency to 1 and then make the humanoid a PlatformStand except this doesn't work... I don't get any failed output but I added the print("hi") just to see if it was the character portion that isn't working... I am really stumped... I am semi-new to scripting so it is probably something obvious...
function playerAdded(player) wait(2) if player.Name == "Player" then local character = player.Character character.Head.Transparency = 1 character.humanoid.PlatformStand = true print("hi") end end game.Players.PlayerAdded:connect(playerAdded)
You should be using CharacterAdded
for this.
game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local head = char:WaitForChild("Head") local hum = char:WaitForChild("Humanoid") head.Transparency = 1 humanoid.PlatformStand = true end) end)
If it doesn't work, try adding a wait immediately after the CharacterAdded
. Sometimes I have to wait a little bit because it doesn't run.
Like stated before, you might want to use .CharacterAdded instead, so that the script runs everytime the player's character is loaded.
local players = game:GetService('Players') players.PlayerAdded:Connect(function(plr) -- once a player joins if(plr.Name == "yourPlayerName") then -- checks if it's the player you're looking for plr.CharacterAdded:Connect(function(char) -- connects to whenever the char loads -- you code goes here -- instead of player.Character you can just then do char.Head end) end end)