So i made a skill that fire a Big white blaster
I anchored the player, so he cant walk, but I want that when the blaster comes out the player turns towards the cursor for the skill to come out in the direction of the cursor (if the player is flying I want him to also be able to use the skill up and down, according to the cursor) , how is this possible? I tried a lot but it’s hard
Code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PureBlaster = ReplicatedStorage.Skills.Pure.PureBlaster
local Meshes = script.Meshes
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local trainingm = require(game.ServerStorage.TrainingFiles.TrainingModule)
local function pureBlasterF(player)
if player.Character.HumanoidRootPart.Anchored == false then
if not workspace:FindFirstChild(player.Name.." Blaster")then
local damage = player.Stats.Mind.Value
local usingSkill = Instance.new("BoolValue")
usingSkill.Name = "usingSkill"
usingSkill.Value = true
usingSkill.Parent = player
print("BLASTER ")
local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
HumanoidRP.Anchored = true
local Track = Humanoid:LoadAnimation(script.Animation)
Track:Play()
--Hold
local Folder = Instance.new("Folder",workspace)
Folder.Name = player.Name.." Blaster"
Folder.Parent = workspace
Debris:AddItem(Folder,3.5)
local PureB = Meshes:WaitForChild("PureB"):Clone()
PureB.CFrame = Character:WaitForChild("LeftHand").CFrame
PureB.Size = Vector3.new(2,2,2)
PureB.Parent = Folder
local PureB2 = Meshes:WaitForChild("PureB"):Clone()
PureB2.CFrame = Character:WaitForChild("RightHand").CFrame
PureB2.Size = Vector3.new(2,2,2)
PureB2.Parent = Folder
local weld = Instance.new("WeldConstraint")
weld.Parent = Folder
weld.Part0 = PureB
weld.Part1 = Character:WaitForChild("LeftHand")
local weld2 = Instance.new("WeldConstraint")
weld2.Parent = Folder
weld2.Part0 = PureB2
weld2.Part1 = Character:WaitForChild("RightHand")
Debris:AddItem(PureB,1.25)
Debris:AddItem(PureB2,1.25)
wait(0.75)
local goal = {}
goal.Size = PureB.Size + Vector3.new(9,0,0)
local info = TweenInfo.new(0.2)
local tween = TweenService:Create(PureB,info,goal)
tween:Play()
local goal = {}
goal.Size = PureB2.Size + Vector3.new(9,0,0)
local info = TweenInfo.new(0.2)
local tween = TweenService:Create(PureB2,info,goal)
tween:Play()
if player:FindFirstChild("shield") then
if player.shield.Value < 3 then
player.shield.Value = player.Shield.Value + 1
end
else
local shield = Instance.new("IntValue")
shield.Name = "shield"
shield.Value = 1
shield.Parent = player
end
coroutine.wrap(function()
print("Entrei no shield")
while workspace:FindFirstChild(player.Name.." Blaster"):FindFirstChild("PureB") do
print("Entrei no shield 2")
wait(0.5)
end
print("Entrei no shield 3")
player.shield.Value = player.shield.Value - 1
if player:FindFirstChild("shield").Value == 0 then
player.shield:Destroy()
end
end)()
while HumanoidRP.Anchored == false do
wait(0.2)
end
local BlasterP = Meshes:WaitForChild("BlasterP"):Clone()
BlasterP.CFrame = Character:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0,0,-1)
BlasterP.Orientation = BlasterP.Orientation + Vector3.new(0,-90,0)
BlasterP.Size = Vector3.new(1,15,15)
BlasterP.Anchored = true
BlasterP.Parent = Folder
local goal = {}
goal.Size = BlasterP.Size + Vector3.new(100,0,0)
goal.CFrame = BlasterP.CFrame * CFrame.new(-50,0,0)
local info = TweenInfo.new(0.2)
local tween = TweenService:Create(BlasterP,info,goal)
tween:Play()
coroutine.wrap(function()
for count = 1,5,1 do
BlasterP.Transparency = BlasterP.Transparency + 0.2
wait(0.2)
end
end)()
local transp = 0.1
wait(0.5)
HumanoidRP.Anchored = false
for count = 1,10,1 do
BlasterP.ParticleEmitter.Transparency = NumberSequence.new(transp,transp)
wait(0.2)
transp = transp + 0.1
end
Debris:AddItem(usingSkill,1.0)
end
end
end
PureBlaster.OnServerEvent:Connect(pureBlasterF)
In addition there are some bugs, if I am walking and using the skill, even stopping the skill leaves very stuck to me if I am stopped and using the skill it comes out correctly, besides I have tried to damage it using the Touched, but no works (I removed it from the code because it isn’t working)