I'm attempting to create a game where you press a button and it changes the size of your players head using the headscale value. So far what I've got is
function KeyPress(input, gameProcessed) if input.KeyCode == Enum.KeyCode.T then game.Workspace._____________________??? end end game:GetService("UserInputService").InputBegan:Connect(KeyPress)
what I need help is with how do you get to your player in workspace?
With local scripts, you have access to the LocalPlayer, which you can get with
--LocalScript local plr = game.Players.LocalPlayer
With any player instance, you can get their character with
local character = plr.Character --Or alternatively... local character = game.Players.LocalPlayer.Character
So your code would be...
local plr = game.Players.LocalPlayer local character = plr.Character function KeyPress(input, gameProcessed) if input.KeyCode == Enum.KeyCode.T then char.Head.Size = --put size here or somethin end end game:GetService("UserInputService").InputBegan:Connect(KeyPress)
Unless you wanted to use workspace...
local plr = game.Players.LocalPlayer function KeyPress(input, gameProcessed) if input.KeyCode == Enum.KeyCode.T then game.Workspace[plr.Name].Head end end
Hope this helps!