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

How do I freeze/change someone's skin tone once they hit a part?

I have been making a game and it involves a level on Weirdmageddon (Gravity Falls, look it up if you don't know.) and in Weirdmageddon there are the eye bats witch turn people into statues. I'm not really a coder but I have found some scripts and none of them worked. My idea was to freeze the character when they hit a part and turn their skin tone grey. If you can help please reply. Thanks

1 comment

0

Do you want their body to be a stone material?

2 answers

There is a pretty simple script that can be written to fix this. Just be sure you set "part" to the brick that you want to touch.

Also, be sure this is NOT a local script.

local part = script.Parent -- Set this to the brick that we touch to get different body colors.
local color = BrickColor.new("Dark stone grey") -- Set this to the color you want them to change to.

part.Touched:Connect(function(hit) -- Fired whenever someone touches our brick
	if hit.Parent:FindFirstChild("Body Colors") then -- We know that it is a player because it has body colors that we can change.
		local bodyColors = hit.Parent["Body Colors"] -- We have to add these brackets because there is a space between Body and Colors.
		-- We will now change all the body colors to the colors set.
		bodyColors.HeadColor = color
		bodyColors.LeftArmColor = color
		bodyColors.RightArmColor = color
		bodyColors.LeftLegColor = color
		bodyColors.RightLegColor = color
		bodyColors.TorsoColor = color
	end
end)

3 comments

0

did you make the character freeze like he asked?

0

Thanks a lot this really helps.

0

But it doesn't freeze the character only changes their skin.

Server Script

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		wait(1)
		for a, b in pairs(Character:GetDescendants()) do
			if b:IsA("BasePart") then
				b.Touched:Connect(function(hit)
					if hit.Parent.Name == "EyeBat" then
						for c, d in pairs(Character:GetDescendants()) do
							-- Set Color
							local color = Color3.fromRGB(150, 150, 150)
							if d.Name == "Body Colors" then
								d.HeadColor3 = color
								d.RightArmColor3 = color
								d.LeftArmColor3 = color
								d.RightLegColor3 = color
								d.LeftLegColor3 = color
								d.TorsoColor3 = color
							-- Set Frozen (d.Anchored = true is possible)
							elseif d.Name == "Humanoid" then
								d.WalkSpeed = 0
								d.JumpPower = 0
							-- Removes Shirt Id (Optional)
							elseif d.Name == "Shirt" then
								d.ShirtTemplate = ""
							--Removes Pants Id (Optional)
							elseif d.Name == "Pants" then
								d.PantsTemplate = ""
							end
							-- Changes Material / PartColor to Slate / Grey
							if d:IsA("BasePart") then
								d.Material = Enum.Material.Slate
								d.Color = color
							-- Makes Accessories Grey (Optional)
							elseif d:IsA("SpecialMesh") then
								d.TextureId = ""
							end
						end
					end
				end)
			end
		end
	end)
end)

First, we make sure that the player has joined and that their character is created (wait(1) is for the character's children to load)

Second, we make a table of all parts in the player so it any of them touch the bat, they are altered

Third, we connect the table to a function which changes: BodyColor, WalkSpeed, JumpPower and then removes the ShirtId / PantsId (these two are optional) and makes their appearance more rocky (Slate Material)

3 comments

0

Only problem with this is that it wont stop the animations

0

Only problem with this is that it wont stop the animations

0

Well they can't run or jump, so the only animation that would run is Idle, right?

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