Script not working as intended

I’m trying to make it so when you say “Change” in the chat it will change you’re startercharacter but I’ve a few things and it’s still not working.

local Players = game:GetService("Players")

local player = Players.LocalPlayer

game.Players.PlayerAdded:Connect(function(player) 
	player.Chatted:Connect(function(msg) 
		if msg == "Change" then 
        -- I'm not sure what to put here
		end
	end)
end)
local PlayersService = game:GetService("Players");
local StringToDetect = ("Changed")

PlayersService.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if string.find(string.lower(Message), string.lower(StringToDetect)) then
			-- do something
			end;
		end;
	end);
end);

This script has always worked for me

It’s not that I’m not sure what to put in where it says do something.

server script: put this thing in serverscriptservice

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player) 
	player.Chatted:Connect(function(msg) 
		if msg == "Change" then 
        -- change the players startercharacter on the server here
		end
	end)
end)

Really?]

… charcharacharlimitlimit

What exactly is it that you want to do?

PlayerAdded not working on Local Script, you need to make it into Script

He said he didn’t know what to put for his script

So in the script where it says “I’m not sure what to put here”. I’m trying to make it so the startercharacter changes.

How, exactly?

Do you want to change the size, shape, what?

charlimitcharlimitcharlimit

What do you want to change? [Charlimit]

I’m new to scripting by the way

I want to change the startercharacter.

Ok(Charlimit)(Charlimit)ffffffff

If you’re just saying startercharacter nobody will understand, which part would you like to change?

I have no clue what that means lol

I want to change the startercharacter i’m using right now in the starterplayer folder. I tried to do game.StarterPlayer.StarterCharcter2.Name = StarterCharacter But that does not work.

I just fixed it right there. With this:

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local davidvenin2015Variable = game.Lighting.davidvenin2015
local NormalStarterCharacter = game.StarterPlayer.StarterCharacter

game.Players.PlayerAdded:Connect(function(player) -- runs every time a player joins
	player.Chatted:Connect(function(msg) -- runs once the player that joined chats a message
		if msg == "davidvenin2015" then -- create your conditions
			davidvenin2015Variable.Name = "StarterCharacter"
			NormalStarterCharacter.Name = "NormalCharacter"
			davidvenin2015Variable.Parent = game.StarterPlayer
			NormalStarterCharacter.Parent = game.Lighting
		end
	end)
end)

But the player has to reset for the startercharacter to change, do you know how to work round this?

Try using Player:LoadCharacter() so the player does not need to reset, if the script is a Serverscript, remove the local player = Players.LocalPlayer

1 Like

Oh, I just tested it with another person and if they reset they become that startercharacter to. Do you know how to make it so it’s just the player who says the word, who’s startercharcater changes.