JaikKaik
|
  |
| Joined: 16 Apr 2011 |
| Total Posts: 153 |
|
|
| 21 Jun 2014 09:17 AM |
bin = script.Parent local pack = bin.Parent local player = pack.Parent local char = game.Workspace:findFirstChild(player.Name)
function onButton1Down(mouse) mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" local hit = mouse.Target if (hit == nil) then return end
if (hit.Name == "Bottle") then local message = Instance.new("Hint") message.Text = "You got a Broken Bottle!" message.Parent = game.Workspace game.Lighting.Bottle:clone().Parent = pack wait(3) message.Text = "Not very good, but useable!" wait(3) message.Parent = nil
end mouse.Icon = "rbxasset://textures\\GunCursor.png" end
function onSelected(mouse) print("Action Tool Selected") mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end
bin.Selected:connect(onSelected)
I want it so when i press the key F it triggers the function. Also should this be a localscript or a normal script? Thanks |
|
|
| Report Abuse |
|
|
| |
|
JaikKaik
|
  |
| Joined: 16 Apr 2011 |
| Total Posts: 153 |
|
|
| 21 Jun 2014 09:36 AM |
| The script is in a tool... how do i make it so when i press F the function starts? |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2014 10:01 AM |
LocalScript.
Mouse = player:GetMouse()
Mouse.KeyDown:connect(function(k) if k:lower() == "f" then FUNCTIONAME(ARGUMENTS) end end) |
|
|
| Report Abuse |
|
|
JaikKaik
|
  |
| Joined: 16 Apr 2011 |
| Total Posts: 153 |
|
|
| 21 Jun 2014 10:18 AM |
| Could you, please, write the whole script? I cant seem to get it to work... |
|
|
| Report Abuse |
|
|
JaikKaik
|
  |
| Joined: 16 Apr 2011 |
| Total Posts: 153 |
|
| |
|
jasondee1
|
  |
| Joined: 26 Jul 2008 |
| Total Posts: 8002 |
|
|
| 22 Jun 2014 06:06 AM |
Mouse = player:GetMouse()
Mouse.KeyDown:connect(function(k) if k:lower() == "f" then onkeydown() end end)
function onkeydown() mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" local hit = mouse.Target if (hit == nil) then return end
if (hit.Name == "Bottle") then local message = Instance.new("Hint") message.Text = "You got a Broken Bottle!" message.Parent = game.Workspace game.Lighting.Bottle:clone().Parent = pack wait(3) message.Text = "Not very good, but useable!" wait(3) message.Parent = nil
end mouse.Icon = "rbxasset://textures\\GunCursor.png" end
Something like this should work. I haven't tested it myself though. |
|
|
| Report Abuse |
|
|