I made a skill called pure blaster:
But have some problems.
1-If i talk and press to fire the skill the blaster appears inside me (even though I’m anchoring a player so he can’t walk at the beginning of the skill)
2-If I jump the same thing happens
I already tried fix, but i dont know what is the problem
Code on Server:
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)()
wait(0.2)
local BlasterP = Meshes:WaitForChild("BlasterP"):Clone()
local offset = Vector3.new(0,0,-1)
BlasterP.CFrame = Character.UpperTorso.CFrame * CFrame.new(offset)
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)
Code on client:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PureBlaster = ReplicatedStorage.Skills.Pure.PureBlaster
local UltraShield = ReplicatedStorage.Skills.UltraShield:WaitForChild("UltraShield")
mouse.KeyDown:connect(function(key)
if key == "e" then
print("eeee")
PureBlaster:FireServer()
elseif key == "f" then //Ignore that, is another skill
print("ffff")
UltraShield:FireServer()
end
end)
So if anyone can helpme, iam trying a lot, but is hard to fix, i dont have any idea.