Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 comment

0

Do you mean like adding a script into a tool that is being generated by a script?

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.