#Updating old roblox code

4 messages · Page 1 of 1 (latest)

rigid vault
#

I was bored and wanted to update the Pizza item because I saw Roblox Studio with new properties for grip. The bug is shown here, and the tool did not end up working at all. What's wrong? ```lua
local Tool = script.Parent;
enabled = true;
function onActivated()
if not enabled then
return;
end
enabled = false;
Tool.Grip.Position = Vector3.new(1.25,-0.75,1.25)
Tool.Grip.Orientation = Vector3.new(0,-81,0)
Tool.Handle.DrinkSound:Play();
wait(.8);
local h = Tool.Parent:FindFirstChild("Humanoid");
if (h ~= nil) then
if (h.MaxHealth > h.Health + 1.6) then
h.Health = h.Health + 1.6
else
h.Health = h.MaxHealth
end
end
Tool.Grip.Position = Vector3.new(0.5,0,-0.08)
Tool.Grip.Orientation = Vector3.new(0,99,0)
enabled = true;
end
function onEquipped()
Tool.Handle.OpenSound:play();
end
script.Parent.Activated:connect(onActivated);
script.Parent.Equipped:connect(onEquipped);

pale mortar
#

so what is that for

#

here is the Fixed code```lua
local Tool = script.Parent;
enabled = true;

function onActivated()
if not enabled then
return;
end
enabled = false;

Tool.Grip.Orientation = Vector3.new(0,-81,0)
Tool.Handle.DrinkSound:Play();
wait(.8);
local h = Tool.Parent:FindFirstChild("Humanoid");
if (h ~= nil) then
    if (h.MaxHealth > h.Health + 1.6) then
        h.Health = h.Health + 1.6
    else    
        h.Health = h.MaxHealth
    end
end

Tool.CFrame = CFrame.new(Vector3.new(1.25,-0.75,1.25), Vector3.new(0, -81, 0))
wait(.3)
Tool.Grip.Orientation = Vector3.new(0,99,0)
Tool.CFrame = CFrame.new(Vector3.new(0.5,0,-0.08), Vector3.new(0, 99, 0))

enabled = true;

end

function onEquipped()
Tool.Handle.OpenSound:play();
end

Tool.Activated:Connect(onActivated);
Tool.Equipped:Connect(onEquipped);```

rigid vault