This code is supposed to make a / the part grow while the user has left click down, and then stops when the user lets go of left click but it's not making the part grow at all, but not printing out any errors.
local Player = script.Parent.Parent.Parent
local bin = script.Parent
local Torso = Player.Character:WaitForChild("Torso")
local Mouse = Player:GetMouse()
local Charging = script.Charge
enabled = true
charging = false --a bool value for the charging
debounce = true
function onButton1Down(mouse)
wait(.2)
charging() --Runs the function charging
Charging = true --Sets charging to true
local x = script.Part:Clone()
x.Parent = game.Workspace
x.CFrame = Player.Character.Torso.CFrame * CFrame.new(0,0,-10)
x.Anchored = false
x.CanCollide = false
local Velocity = Instance.new("BodyVelocity", x)
Velocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
Velocity.velocity = Player.Character.Torso.CFrame.lookVector*40
fd = script.Firedamage:Clone()
fd.Parent = x
end
function charging() --Charging function
while Charging == true do --Makes the part bigger while charging == true
local x = game.Workspace:WaitForChild("Part")
x.Size = Vector3.new(1,1,1)
wait(0.1)
end
end
Mouse.Button1Up:connect(function() --Sets charging to false when you lift up your button
Charging = false
end)
function onS(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onS)
