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

How to a put a keydown press script in a tool also in this script?

Asked by 8 years ago
local x = Instance.new("Part")
        x.BrickColor = BrickColor.new("Bright red")
        x.Size = Vector3.new(10, 10, 10)
        x.TopSurface = "Smooth"
        x.BottomSurface = "Smooth"
        x.Shape = "Ball"
        x.Name = Player.Name
        x.CanCollide = false
        x.Transparency = 0.7
        local fd = script.Firedamage:clone()
        fd.Parent = x
        local y = Instance.new("BodyVelocity")
        y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
        y.velocity = Player.Character.Torso.CFrame.lookVector*80
        x.Parent = Workspace
        y.Parent = x
        local f = Instance.new("Fire", x)
        f.Size = 15
        f.Heat = 0
        x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -12)
        fd.Disabled = false
        game.Debris:AddItem(x, 6)
        wait(0.25)
        for i = 1, 12 do
            LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0.1, 0)
            RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, -0.1, 0)
            LeftShoulder.C0 = LeftShoulder.C0 *CFrame.Angles(0, 0, 0.16)
            RightShoulder.C0 = RightShoulder.C0 *CFrame.Angles(0, 0, -0.16)
            Run.Stepped:wait(0.01)
end
0
Do you mean like adding a script into a tool that is being generated by a script? MrLonely1221 701 — 8y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

If you're looking to have it perform that function on a KeyDown, you'll have to Get the user's mouse, and use the KeyDown event. You didn't show any effort to perform that task, so I obviously won't provide you with the solution code. If you check the wiki, search KeyDown, you'll see how it's used. Note: KeyDown may only be used in a LocalScript. If you're looking to use it in a server sided script, you'll have to set up a remote event to fire from a local script to the server, to perform your task.

Ad

Answer this question