Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make a player grow when they join?

Asked by 4 years ago
01local Plr = game:GetService("Players")
02local LocalPlr = Plr.LocalPlayer
03local Humanoid = LocalPlr.Character or LocalPlr.CharacterAdded:Wait()
04repeat wait() until Humanoid:FindFirstChild("Humanoid")
05 
06local BodyDepthScale = Humanoid:WaitForChild("BodyDepthScale")
07local BodyWidthScale = Humanoid:WaitForChild("BodyWidthScale")
08local Properties = {"BodyDepthScale","BodyWidthScale"}
09 
10local Scale = 1
11 
12for _, v in pairs(Properties) do
13    Humanoid[v].Value = Humanoid[v].Value + Scale
14    end

It is a local script located in StarterPlrCharacterScripts

0
Why do you have the in pairS looP? It sEems unneccessary so Do explain. abstractedfrostbite 110 — 4y

2 answers

Log in to vote
0
Answered by
sayer80 457 Moderation Voter
4 years ago

Put this script into ServerScriptService the explanation is inside the code as you can see.

01local multiplier = 2 -- the multiplier is 2 so the body will grow 2x
02 
03game.Players.PlayerAdded:Connect(function(plr) -- when player joins
04    plr.CharacterAdded:Connect(function(char) -- when a character gets added
05        local hum = char:WaitForChild("Humanoid") -- gets humanoid of new character
06        hum.BodyHeightScale.Value = multiplier -- changes height
07        hum.BodyWidthScale.Value = multiplier -- changes width
08        hum.BodyDepthScale.Value = multiplier -- changes depth
09        hum.HeadScale.Value = multiplier -- changes headsize
10        hum.WalkSpeed = multiplier*16 -- changes walkspeed accordingly
11        hum.JumpPower = multiplier*50 -- changes jumppower accordingly
12        -- feel free to remove any stuff like depth and width and head to make the person only grow and stuff
13        -- you can also do like 2*multiplier to make it grow even 2x the multiplier on some values
14    end)
15end)
Ad
Log in to vote
-2
Answered by 4 years ago

Hi, You would make a function my friend. It should be something like this:

function playerJoin()

--Code here, also code that changes player size

end

game.Players.PlayerAdded:Connect(playerJoin) -- Connect the function with an event called on playeradded.

This would run every time a player joins and also if this is a local script only the player can see it and no one else can. You can also double check if the functions runs by typing in print statement called print("A player has joined"). It should print in the output window that a player has joined.

0
You'd need CharacterAdded, because when the player resets, the size reverts. sayer80 457 — 4y

Answer this question