Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Quire = _G.Quire
- local ClientProjectileHandler = Quire("ClientProjectileHandler")
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local rightHand = character:WaitForChild("RightHand")
- local mouse = player:GetMouse()
- local tool = script.Parent
- local remotesFolder = tool.Remotes
- local shootEvent = remotesFolder.ShootEvent
- local toolStatsFolder = tool.Stats
- local toolStateFolder = tool.State
- local PROJECTILE_TEMPLATE = toolStatsFolder.ProjectileTemplate.Value
- local MIN_SIZE = toolStatsFolder.MinSize.value
- local MAX_CHARGE = toolStatsFolder.MaxCharge.Value
- local CHARGE_SPEED = toolStatsFolder.ChargeSpeed.Value
- local CHARGE_INCREMENT = toolStatsFolder.ChargeIncrement.Value
- local SIZE_PER_CHARGE = toolStatsFolder.SizePerCharge.Value
- local DAMAGE = toolStatsFolder.Damage.Value
- local VELOCITY = toolStatsFolder.Velocity.Value
- local RANGE = toolStatsFolder.Range.Value
- -- state
- local chargingPart = toolStateFolder.ChargingPart
- local charge = toolStateFolder.Charge
- local isCharging = toolStateFolder.IsCharging
- local function shoot()
- if isCharging.Value then
- local size = (charge.Value * SIZE_PER_CHARGE)
- size = MIN_SIZE + Vector3.new(size, size, size)
- local projectile = PROJECTILE_TEMPLATE:Clone()
- projectile.Size = size
- projectile.Parent = workspace
- local origin = rightHand.Position
- local direction = (mouse.Hit.Position - origin).Unit
- local velocity = direction * VELOCITY
- local range = direction * RANGE
- ClientProjectileHandler:FireProjectile(tool, origin, range, velocity, projectile, workspace)
- shootEvent:FireServer(direction)
- end
- end
- tool.Deactivated:Connect(shoot)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement