It took me a lot of times to added in the mesh for the tool and it works perfectly except there is one problem though. The mesh isn't facing the right direction and I tried to add in CFrame so I could rotate the part in for it to face the right direction but I'm not good with CFrame. Can somebody help me out?
--Made by Luckymaxer
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Mesh = Handle:WaitForChild("Mesh")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
BaseUrl = "http://www.roblox.com/asset/?id="
Particle = script:WaitForChild("Particle")
HitScript = script:WaitForChild("HitScript")
Grips = {
Unequipped = Tool.Grip,
Equipped = Tool.Grip,
}
Animations = {
Slash = {Animation = Tool:WaitForChild("Slash"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 0.5},
Chop = {Animation = Tool:WaitForChild("Chop"), FadeTime = 0, Weight = nil, Speed = 1.25, Duration = 0.5},
Spin = {Animation = Tool:WaitForChild("Spin"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 1},
}
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Strike = Handle:WaitForChild("Strike"),
}
BasePart = Create("Part"){
Shape = Enum.PartType.Block,
Material = Enum.Material.Plastic,
FormFactor = Enum.FormFactor.Custom,
TopSurface = Enum.SurfaceType.Smooth,
BottomSurface = Enum.SurfaceType.Smooth,
Size = Vector3.new(0.2, 0.2, 0.2),
Locked = true,
CanCollide = true,
Anchored = false,
}
BaseOrb = BasePart:Clone()
BaseOrb.Name = "Projectile"
BaseOrb.Transparency = 0.2
BaseOrb.BrickColor = BrickColor.new("Bright yellow")
BaseOrb.Material = Enum.Material.SmoothPlastic
BaseOrb.Size = Vector3.new(1, 1, 1)
BaseOrb.CanCollide = false
local BaseOrbMesh = Instance.new("SpecialMesh")
BaseOrbMesh.Scale = Vector3.new(5, 5, 5)
BaseOrbMesh.MeshId = "http://www.roblox.com/asset/?id=723097791"
BaseOrbMesh.TextureId = "http://www.roblox.com/asset/?id=65419395"
BaseOrbMesh.Parent = BaseOrb
ParticleEffect = Particle:Clone()
ParticleEffect.LockedToPart = false
ParticleEffect.Enabled = true
ParticleEffect.Parent = BaseOrb
StrikeSound = Sounds.Strike:Clone()
StrikeSound.Parent = BaseOrb
Gravity = 196.20
Rate = (1 / 60)
Shots = {Total = 6, Used = 0}
ShotReload = 10
FireRate = 0.125
ToolEquipped = false
Remotes = Tool:WaitForChild("Remotes")
ServerControl = (Remotes:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Remotes,
})
ClientControl = (Remotes:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Remotes,
})
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
v:Destroy()
end
end
Handle.Transparency = 1
Tool.Grip = Grips.Unequipped
Tool.Enabled = true
function Fire(TargetPosition)
Shots.Used = (Shots.Used + 1)
Delay(ShotReload, (function()
Shots.Used = (Shots.Used - 1)
if Shots.Used < Shots.Total then
Tool.Enabled = true
end
end))
local CurrentlyEquipped = true
if ToolUnequipped then
ToolUnequipped:disconnect()
end
ToolUnequipped = Tool.Unequipped:connect(function()
CurrentlyEquipped = false
end)
local AttackAnimations = {Animations.Slash, Animations.Chop}
local AnimationChosen = AttackAnimations[math.random(1, #AttackAnimations)]
Spawn(function()
InvokeClient("PlayAnimation", AnimationChosen)
end)
wait(AnimationChosen.Duration / 2)
if not CheckIfAlive() or not ToolEquipped or not CurrentlyEquipped then
return
end
local Projectile = BaseOrb:Clone()
local SpawnPosition = (Handle.CFrame * CFrame.new(0, ((Handle.Size.Y / 2) - (Projectile.Size.Y / 2)), 0))
local TargetDirection = CFrame.new(SpawnPosition.p, TargetPosition)
local Speed = 110
local Velocity = (TargetDirection.lookVector * Speed)
local Mass = (Projectile:GetMass() * Gravity)
local BodyVelocity = Create("BodyVelocity"){
Name = "BodyVelocity",
maxForce = Vector3.new(Mass, Mass, Mass),
velocity = Velocity,
Parent = Projectile,
}
Projectile.Velocity = Velocity
local Values = {
{Name = "Creator", Class = "ObjectValue", Value = Player},
{Name = "Damage", Class = "NumberValue", Value = math.random(25, 40)},
{Name = "Radius", Class = "NumberValue", Value = 3.25},
}
for i, v in pairs(Values) do
local Value = Create(v.Class){
Name = v.Name,
Value = v.Value,
Parent = Projectile,
}
end
local HitScriptCopy = HitScript:Clone()
HitScriptCopy.Disabled = false
HitScriptCopy.Parent = Projectile
Projectile.CFrame = SpawnPosition
Debris:AddItem(Projectile, 5)
local ParticleEffect = Projectile.Particle
Delay(2.5, (function()
ParticleEffect.Enabled = false
end))
Projectile.Parent = game:GetService("Workspace")
end
function Activated()
local MouseData = InvokeClient("MouseData")
if not Tool.Enabled or not CheckIfAlive() or not MouseData or not MouseData.Position or Shots.Used >= Shots.Total then
return
end
Tool.Enabled = false
local Sound = Sounds.Fire:Clone()
Debris:AddItem(Sound, 1.25)
Sound.Parent = Handle
Sound:Play()
Fire(MouseData.Position)
wait(FireRate)
if Shots.Used < Shots.Total then
Tool.Enabled = true
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not CheckIfAlive() then
return
end
Tool.Grip = Grips.Equipped
ToolEquipped = true
end
function Unequipped()
Tool.Grip = Grips.Unequipped
ToolEquipped = false
end
function OnServerInvoke(player, mode, value)
if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
return
end
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)

1 comment
I don't understand what you're asking here can you make another question with a better explanation?