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

How do I make it work when I press f on my keyboard instead of clicking?

Void = script.Parent
local Tool = script.Parent
play = Tool.Parent.Parent 
char = play.Character
hum = char.Humanoid 
root = char.HumanoidRootPart

local en = true


Tool.RemoteEvent.OnServerEvent:connect(function(play,mousehit)	
 local a = hum:LoadAnimation(Tool.Throw)
 a:Play() Void.Sound:Play() hum.WalkSpeed = 0 
 root.CFrame = CFrame.new(root.Position,root.Position + Vector3.new(mousehit.lookVector.x,0,mousehit.lookVector.z))
 wait(2.5)
 Void.Sound2:Play()
 hum.WalkSpeed = 16
 local void = Tool.Handle:clone()
 void.CFrame = Tool.Handle.CFrame
 local bv = Instance.new("BodyVelocity")
 bv.MaxForce = Vector3.new(1e8,1e8,1e8)
 bv.Velocity = mousehit.lookVector * 50
 bv.Parent = void
 void.CanCollide = false
 void.Parent = game.Workspace
 game.Debris:AddItem(void,4)
 local ten = true
 void.Touched:connect(function(hit)
 if not ten then return end
 ten = false
 local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
 if ehum and ehum ~= hum then
  ehum:TakeDamage(75) -- Quantos de dano como vai ser op coloquei 75
 elseif hit.Anchored  == true and hit.CanCollide == true then
  for i=1,10 do
   local part = void:clone()
   part.Size = Vector3.new(10,10,10)
   part.CFrame = void.CFrame
   part.ParticleEmitter.LockedToPart = false
   part.BodyVelocity.Velocity = Vector3.new(math.random(-25,25),math.random(-25,25),math.random(-25,25))
   part.Parent = game.Workspace
   game.Debris:AddItem(part,1)
Void.Sound3:Play()
  end
 end
 wait()
 ten = true
 end)
end)

2 comments

0

This isn't a request site. But what you're looking for is UserInputService.

0

Also, PLEASE indent. You don't have to, but it makes it much easier for people to read.

1 answer

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