Hey. I want to change some of my character's properties such as the color and walk speed when I touch a part, but for some reason my script doesn't do it. But instead, if I wanna print something when I touch that part my script prints it. Any ideas why it doesn't work? Script:
local spawnerModel = game.Workspace:WaitForChild("SpawnerModel") local spawner = spawnerModel:WaitForChild("Spawner") spawner.Touched:Connect(function(person) local name = person.Name local playeroutofeveryone = game.Players:FindFirstChild(name) if playeroutofeveryone ~= nil then wait() local Armor = game.ReplicatedStorage:WaitForChild("Armor") local Armorholder = Instance.new("Model", person) Armorholder.Name = "Upgrade" person.Humanoid.BodyDepthScale.Value = script.DepthScale.Value person.Humanoid.BodyHeightScale.Value = script.HeightScale.Value person.Humanoid.BodyWidthScale.Value = script.WidthScale.Value person.Humanoid.HeadScale.Value = script.HeadScale.Value person.Shirt.ShirtTemplate = script.Shirt.Value person.Pants.PantsTemplate = script.Pants.Value local BodyColors = person:WaitForChild("Body Colors") BodyColors.HeadColor = BrickColor.new("Black") BodyColors.LeftArmColor = BrickColor.new("Black") BodyColors.LeftLegColor = BrickColor.new("Black") BodyColors.RightArmColor = BrickColor.new("Black") BodyColors.RightLegColor = BrickColor.new("Black") BodyColors.TorsoColor = BrickColor.new("Black") person.Humanoid.WalkSpeed = 20 person.Humanoid.MaxHealth = 1000 person.Humanoid.JumpPower = 100 end end)
:D You need use like that!:
local spawnerModel = workspace:WaitForChild("SpawnerModel") local spawner = spawnerModel:WaitForChild("Spawner") local Players = game:GetService("Players") spawner.Touched:Connect(function(hit) if Players:GetPlayerFromCharacter(hit.Parent) then local Player = Players[hit.Parent.Name] --etc.. end end)