this is a script of a tool that can grow the size of a player, i want convert it to a image button, i can do this right? just converting the function of (MouseButton) to (OnClick) right?
bin = script.Parent character=game.Players.LocalPlayer.Character siting= false function onButton1Down(mouse) resizeImplementation(character, 1.42) wait(0.03) end function resizeModelInternal(model, resizeFactor) local modelCFrame = model:GetModelCFrame() local modelSize = model:GetModelSize() local baseParts = {} local basePartCFrames = {} local joints = {} local jointParents = {} local meshes = {} findObjectHelper(model, ".*", "BasePart", baseParts) findObjectHelper(model, ".*", "JointInstance", joints) -- meshes don't inherit from anything accessible? findObjectHelper(model, ".*", "FileMesh", meshes) -- base class for SpecialMesh and FileMesh findObjectHelper(model, ".*", "CylinderMesh", meshes) findObjectHelper(model, ".*", "BlockMesh", meshes) -- store the CFrames, so our other changes don't rearrange stuff for _, basePart in pairs(baseParts) do basePartCFrames[basePart] = basePart.CFrame end -- scale meshes for _,mesh in pairs(meshes) do -- This is a nasty hack because head meshes scale relative to the part's size -- thus scaling the mesh and the head gives u 2x the size if mesh.Parent.Name ~= "Head" then mesh.Scale = mesh.Scale * resizeFactor end end -- scale joints for _, joint in pairs(joints) do joint.C0 = joint.C0 + (joint.C0.p) * (resizeFactor - 1) joint.C1 = joint.C1 + (joint.C1.p) * (resizeFactor - 1) jointParents[joint] = joint.Parent end -- scale parts and reposition them within the model for _, basePart in pairs(baseParts) do if pcall(function() basePart.FormFactor = "Custom" end) then basePart.FormFactor = "Custom" end basePart.Size = basePart.Size * resizeFactor local oldCFrame = basePartCFrames[basePart] local oldPositionInModel = modelCFrame:pointToObjectSpace(oldCFrame.p) local distanceFromCorner = oldPositionInModel + modelSize/2 distanceFromCorner = distanceFromCorner * resizeFactor local newPositionInSpace = modelCFrame:pointToWorldSpace(distanceFromCorner - modelSize/2) basePart.CFrame = oldCFrame - oldCFrame.p + newPositionInSpace end -- pop the joints back, because they prolly got borked for _, joint in pairs(joints) do joint.Parent = jointParents[joint] end return model end function resizeImplementation(modelList, resizeFactor) if type(modelList) ~= "table" then modelList = {modelList} end for _, model in pairs(modelList) do --if model.Name ~= "BackPack" then resizeModelInternal(model, resizeFactor) --end end return modelList end local foundObjectList = {} local foundObjectIndex = 1 function findObjectHelper(model, objectName, className, listOfFoundObjects) if not model then return end local findStart, findEnd = string.find(model.Name, objectName) if findStart == 1 and findEnd == #(model.Name) then -- must match entire name if not className or model.className == className or (pcall(model.IsA, model, className) and model:IsA(className)) then table.insert(listOfFoundObjects, model) end end if pcall(model.GetChildren, model) then local modelChildren = model:GetChildren() for i = 1, #modelChildren do -- make sure not to resize tools, things tend to get complicated if we do if not (pcall(modelChildren[i].IsA, modelChildren[i], 'Tool') and modelChildren[i]:IsA('Tool')) then findObjectHelper(modelChildren[i], objectName, className, listOfFoundObjects) end end end end function onSelected(mouse) if (siting == true) then return end mouse.Button1Down:connect(function () onButton1Down(mouse) end) end bin.Selected:connect(onSelected)