Need Help on scaling up character after Chatted!

Hello Devs! Today I started creating a new game for my own entertainment, but unfortunately was stuck on a certain script. So I looked up a few tutorials, used some of my previous knowledge in scripting, however, failed miserably. The whole point of my game was “asserting dominance” so I was trying to make a script where when you typed the letter “A”, your character grew bigger (don’t question my game ideas, I’m a very interesting person)

Here is the script

What did I do wrong, and what can I do to fix this. I would really appreciate if you could help :yum:

P.S. Also if you guys were wondering what popped up in the output it was this :point_down:
why
This is what pops up when I say the letter “A” in the chat

@jxzzify try this:

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg)
        if msg == "A" then
            local humanoid = player.Character:FindFirstChild("Humanoid")
            --change the things here
        end
    end)
end)
plrAdded:Conect(blahbalh)
	local character = game.Workspace:FindFirstChild(player.Name)
	local humanoid
	if character ~= nil then
		humanoid = character:FindFirstChild("Humanoid")
	end
	plrMessaged:Connect(blahblah)
	end
end

Is this a Local Script Or A Script?

Oh yea one problem might be the fact it isn’t a local script.

it should be server script, so u are in the right here

Maybe Try this.

game.Players.PlayerAdded:Connect(function(player)
       player.CharacterAdded:Connect(function(Char)
         local humanoid = Char:WaitForChild("Humanoid")
       player.Chatted:Connect(function(Message)
           if Message == "A" then
             -- What  u want to do
         end
    end)
end)

It does need to be a server script, but you need to get the Humanoid from the player that chatted, not some random one at the start. If you paste the code I could edit it for your liking. Where is this script placed in the explorer also?

Why should he take the humanoid from workspace if he can use: player.Character:FindFirstChild("Humanoid") ?

1 Like

u cant be sure if character really exists tho, for example upon death it gets removed, so u would soon get an error

Not if you use the function player.CharacterAdded

characterAdded is an event that fires when character is added in workspace and cant be used as an indicator if character exists

some spawns can be delayed by long time and she would get script exhaustion + what happens if second plr chats during waiting for character

game.Players.PlayerAdded:Connect(function(Player)
  player.CharacterAdded:Connect(function()
  print(player.Name.." 's Character Was Added)
       end)
end)

@AstonAceMan @nuttela_for1me @YT_Forceman @NinjaFurfante07

You guys are really kind to be helping me, however, I am going to be to bed so I’ll see if these solutions work tomorrow. Peace :v:

3 Likes

The Script i showed Says

player.CharacterAdded

Here we dont know the Player. But its specific. Its the Specific player who joined the game

1 Like

I dont see why would u be by characterAdded event sure that character is not equal to nil, if u would want it that way u should connect two events at once (humanoid.Died and characterAdded) so u would actually know if there is a character. But anyways I am done w this discussion

@AstonAceMan @nuttela_for1me @YT_Forceman @NinjaFurfante07

BOTH
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if msg == “A” then
local humanoid = player.Character:FindFirstChild(“Humanoid”)
–change the things here
end
end)
end)

AND

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Char)
local humanoid = Char:WaitForChild(“Humanoid”)
player.Chatted:Connect(function(Message)
if Message == “A” then
– What u want to do
end
end)
end)

WORKED!

I hope I’m not asking too much from you guys but is there any a person could grow taller based on how many A’s they say? Like if you were to say “AAAAAAA” you would grow seven times

Now I’m gonna be in this conversation lol

You could probably use the string.len/string.match functions, string.len basically returns back the amount of strings used in the MSG

(I believe) string.match will attempt to find the string pattern dependent on what your MSG variable is, otherwise it returns nil

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local Humanoid = Character:WaitForChild("Humanoid")
        Player.Chatted:Connect(function(MSG)
            local Length = string.len(MSG)
            local ScaleBalance = Length * 1.1
            local PropertyBalance = Length * 1.05

            if string.match(MSG, "A") then
                Humanoid.BodyWidthScale.Value += ScaleBalance
                Humanoid.BodyDepthScale.Value += ScaleBalance
                Humanoid.BodyHeightScale.Value += ScaleBalance
                Humanoid.HeadScale.Value += ScaleBalance

                Humanoid.WalkSpeed += PropertyBalance
                Humanoid.JumpPower += PropertyBalance
            end 
        end)
    
    end)
end)

I believe you could do something like this, but I’m not certain