i am trying to make a thing when u press r you turn into something but it wont work how do i fix?
local unfrom = false
local plr = game.Players.LocalPlayer
local chr = plr.Character
local ref = game.Workspace.Part
local hum = chr:WaitForChild("Humanoid")
local InputService = game:GetService("UserInputService")
InputService.InputBegan:Connect(function(input)
local val = script.Parent.Transfrombodything.OFFORON
-- on
local key = input.KeyCode
if key == Enum.KeyCode.R then
if unfrom == true then
val.Value = "OFF"
for _,body in pairs(chr:GetChildren()) do
if body:IsA("BasePart") then
body.BrickColor = BrickColor.new("Gold")
body.Material = "Neon"
end
for _,size in pairs(hum:GetChildren())do
if size:IsA("NumberValue") then
size.Value = 5
end
-- "BodyDepthScale" or "BodyWidthScale" or "HeadScale" then
--resize.Value = 7
hum:WaitForChild("BodyDepthScale").Value = 10
hum:WaitForChild("BodyWidthScale").Value = 7.89
hum:WaitForChild("HeadScale").Value = 6
unfrom = true
end
end
end
end
end)
-----
--off
InputService.InputBegan:Connect(function(input)
local plr = game.Players.LocalPlayer
local chr = plr.Character
local hum = chr.Humanoid
local key = input.KeyCode
if key == Enum.KeyCode.R then
if unfrom == true then
local tem = script.Parent.Transfrombodything:WaitForChild("OFFORON")
if tem.Value == "ON" then
tem.Value = "OFF"
end
if tem.Value == "OFF" then
for _,tr in pairs(script.Parent.Transfrombodything:GetChildren()) do
if tr:IsA("NumberValue") then
--local copy = tr:Clone()
for _,kill in pairs(hum:GetChildren()) do
if kill:IsA("NumberValue") then
kill.Value = 2
wait(.12)
--copy.Parent = hum
end
end
end
end
end
end
end
unfrom = false
end)