Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

can you help me execute a skill only when tool is equiqqed?

Asked by 4 years ago

so i have a script that makes me execute a skill but i want it can only be executed when tool is equiqqed so this is my script:local RS = game:GetService("ReplicatedStorage") local StartKame = Instance.new("RemoteEvent",RS) local LaunchKame = Instance.new("RemoteEvent",RS)

StartKame.Name = "StartKameEvent" LaunchKame.Name = "LaunchKameEvent"

StartKame.OnServerEvent:Connect(function(player) local Character = game.Workspace:WaitForChild(player.Name) local Humanoid = Character.Humanoid local Torso = Character.UpperTorso local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://4815692917" local PlayAnim = Humanoid:LoadAnimation(Anim) PlayAnim:Play() local BV = Instance.new("BodyVelocity",Character.HumanoidRootPart) BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BV.Velocity = Character.HumanoidRootPart.CFrame.lookVector.01 local START = Instance.new("Part",Character) START.Name = "StartKame" START.Anchored = false START.CanCollide = false START.Shape = "Ball" START.Material = "Neon" START.BrickColor = BrickColor.new("Pink") START.Size = Vector3.new(.1,.1,.1) START.CFrame = Torso.CFrame + Torso.CFrame.lookVector1 local weld = Instance.new("WeldConstraint",START) weld.Part0 = START weld.Part1 = Torso local TweenService = game:GetService("TweenService") local TI = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0) local properties = { Size = Vector3.new(2,2,2)--niet veranderen-- } local Tween = TweenService:Create(START,TI,properties) Tween:Play() end)

LaunchKame.OnServerEvent:Connect(function(player) local Character = game.Workspace:WaitForChild(player.Name) if Character:FindFirstChild("StartKame") then local StartKame = Character.StartKame local Damage = script.Damage:Clone() local Humanoid = Character.Humanoid local HumRP = Character.HumanoidRootPart local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://4815692917" local PlayAnim = Humanoid:LoadAnimation(Anim) PlayAnim:Play() StartKame:FindFirstChildOfClass("WeldConstraint"):Destroy() StartKame.Anchored = true wait() StartKame.CFrame = HumRP.CFrame + HumRP.CFrame.lookVector10--afstand van de speler en de skill-- local Kame = Instance.new("Part",Character) Kame.Anchored = true Kame.CanCollide = false Kame.Shape = "Ball" Kame.Material = "Neon" Kame.BrickColor = BrickColor.new("Pink") Kame.Size = Vector3.new(.1,3,3) Kame.CFrame = StartKame.CFrame Kame.Orientation = Kame.Orientation + Vector3.new(90,90,0) Damage.Parent = Kame Damage.Disabled = false local TweenService = game:GetService("TweenService") local TI = TweenInfo.new(.2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0) local properties = { Size = Vector3.new(106.89, 106.89, 106.89), CFrame = Kame.CFrame + Kame.CFrame.rightVector50 } local Tween = TweenService:Create(Kame,TI,properties) Tween:Play() wait(5)--moet3zijn-- local TI2 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0) local properties2 = { Size = Vector3.new(106.89, 106.89, 106.89), Transparency = 0.5 } local Tween2 = TweenService:Create(Kame,TI2,properties2) Tween2:Play()

    local TI3 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
    local properties3 = {
        Size = Vector3.new(.1,.1,.1),
        Transparency = 0.5
    }
    local Tween3 = TweenService:Create(StartKame,TI3,properties3)
    Tween3:Play()
    wait(10)
    StartKame:Destroy()
    Kame:Destroy()
    local Velocity = HumRP:FindFirstChildOfClass("BodyVelocity")
    if Velocity then
        Velocity:Destroy()
    end
end

end)

and this is my local script:local StartKame = game.ReplicatedStorage:WaitForChild("StartKameEvent") local LaunchKame = game.ReplicatedStorage:WaitForChild("LaunchKameEvent")

local UIS = game:GetService("UserInputService")

local debounce = false local toggle = false

UIS.InputBegan:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E then if debounce == false then if toggle == false then debounce = true toggle = true StartKame:FireServer() wait(50) if toggle == true then toggle = false LaunchKame:FireServer() end wait(10) debounce = false end end end end)

UIS.InputEnded:Connect(function(Input) if Input.KeyCode == Enum.KeyCode.E then if toggle == true then toggle = false LaunchKame:FireServer()

    end
end

end)

could you tell me what to change please i would appreciate it

0
can you put the whole script in lua Fxding_cam 60 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

I’m not sure if this will work since I’m not at my pc right now but try


Tool.equipped:Connect(function() End)

And please place your code in code blocks next time

Ad

Answer this question