Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Right Leg is not a valid member of Workspace & Left Leg is not a valid member of Workspace?

So I'm trying to make it to where once you step on a certain SpawnPoint your torso color changes. I also changed the Starting Character to a default r6 character. If there's any way that this could be fixed It would be great.

local rougSpawn1 = game.Workspace.Terrain.Land.Spawns.RougSpawn
local rougSpawn2 = game.Workspace.Terrain.Land.Spawns.RougSpawn2
local rougSpawn3 = game.Workspace.Terrain.Land.Spawns.RougSpawn3
local rougSpawn4 = game.Workspace.Terrain.Land.Spawns.RougSpawn4


rougSpawn1.Touched:Connect(function(player)

	game.Workspace[player.Name].Torso.BrickColor = BrickColor.new("Sea green")
	game.Workspace[player.Name].Humanoid.MaxHealth = 80
	game.Workspace[player.Name].Humanoid.WalkSpeed = 22
end)

rougSpawn2.Touched:Connect(function(player)
	
	game.Workspace[player.Name].Torso.BrickColor = BrickColor.new("Sea green")
	game.Workspace[player.Name].Humanoid.MaxHealth = 80
	game.Workspace[player.Name].Humanoid.WalkSpeed = 22
end)

rougSpawn3.Touched:Connect(function(player)
	
	game.Workspace[player.Name].Torso.BrickColor = BrickColor.new("Sea green")
	game.Workspace[player.Name].Humanoid.MaxHealth = 80
	game.Workspace[player.Name].Humanoid.WalkSpeed = 22
end)

rougSpawn4.Touched:Connect(function(player)
	
	game.Workspace[player.Name].Torso.BrickColor = BrickColor.new("Sea green")
	game.Workspace[player.Name].Humanoid.MaxHealth = 80
	game.Workspace[player.Name].Humanoid.WalkSpeed = 22
end)

It also seems like after touching the spawn that your maxhealth or speed doesn't change either.

3 comments

0

why with the rougSpawn values the numbers at the end are indicated as int values?

0

I'll change it

0

You have to do game.Workspace.PlayersName

1 answer

✓ Accepted answer

The variable inside touch is the brick that hit the touch brick. You'd get the character by saying

if(game.Players:FindFirstChild(nameOfParameterGoesHere.Parent.Name))then
	local player = nameOfParameterGoesHere.Parent
	--all the rest of your code can go here. 
end

2 comments

0

Thanks

0

ty

This discussion is preserved as it was. New answers, comments, and votes are closed.