generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Please help with this script

Previous Thread :: Next Thread 
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
20 May 2014 06:59 PM
Ok This scrip is for a tool i made its just a normal tool block and i added this script to it.

I have not scripted in years so i'm very rusty so please bare with me if i do something stupid or if things have changed. This script should basically when you press the letter "t" while the tool is equipped it will place a black block then a orange block and then black and then orange and so on just by spamming the k button. Then when you press the letter "y" it will remove all the blocks named "Tape O" and "Tape B". The blocks will be spawned in the players head whom is using the tool. Then when you press the key "U" you can make those blocks named "Tape O" and "Tape B" have cancollide true and the the key "I" will make it so that they are not cancollide so the player using the tool can switch it on and off to whether it is cancollide or not.
Please help me fix this thanks:D

--by TreeLineUser

script.Parent.Equipped:connect(function(mouse)
mouse.KeyDown:connect(function(T)

local T= Instance.new('Part',game:GetService'Workspace')
t.Size=Vector3.new(1,1,1)
t.Anchored=true
t.CFrame=game:GetService'Players'.LocalPlayer.Character:FindFirstChild'Head'.CFrame
t.Transparency=.4
t.BrickColor.new'Black'
t.Name = "Tape B"
wait(1)
t.BrickColor.new'Bright Orange'
t.Name = "Tape O"
t.CanCollide = false
wait(0.1)

mouse.KeyDown:connect(function(Y)
game.Workspace.Tape B:remove()
game.Workspace.Tape O:remove()

mouse.KeyDown:connect(function(U)
game.Workspace.Tape B.CanCollide = true
game.Workspace.Tape O.CanCollide = true

mouse.KeyDown:connect(function(I)
game.Workspace.Tape B.CanCollide = false
game.Workspace.Tape O.CanCollide = false
end
end
end
end
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
20 May 2014 07:01 PM
The 'Tape B' and 'O' must be in quotations.

game.Workspace.Tape B -- Wrong.

game.Workspace['Tape B'].CanCollide = false -- Correct.

game.Workspace:FindFirstChild('Tape B').CanCollide = false -- Correct.
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
20 May 2014 07:03 PM
What's the difference between using game.Workspace['Tape B'].CanCollide = false -- Correct.
and using game.Workspace:FindFirstChild('Tape B').CanCollide = false -- Correct.
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
20 May 2014 07:05 PM
FindFirstChild('') will also see if it is nil, or does not exist.
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
20 May 2014 07:07 PM
Ok but technically it wont make a difference right?
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
20 May 2014 07:15 PM
Ok i got this now but still not working.

--by TreeLineUser

script.Parent.Equipped:connect(function(mouse)
mouse.KeyDown:connect(function(T)

local T= Instance.new('Part',game:GetService'Workspace')
t.Size=Vector3.new(1,1,1)
t.Anchored=true
t.CFrame=game:GetService'Players'.LocalPlayer.Character:FindFirstChild'Head'.CFrame
t.Transparency=.4
t.BrickColor.new'Black'
t.Name = 'Tape B'
wait(1)
t.BrickColor.new'Bright Orange'
t.Name = 'Tape O'
t.CanCollide = false
wait(0.1)

mouse.KeyDown:connect(function(Y)
game.Workspace.Tape B:remove()
game.Workspace.Tape O:remove()

mouse.KeyDown:connect(function(U)
game.Workspace['Tape B'].CanCollide = true
game.Workspace['Tape 0'].CanCollide = true

mouse.KeyDown:connect(function(I)
game.Workspace['Tape B'].CanCollide = false
game.Workspace['Tape 0'].CanCollide = false
end
end
end
end
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
20 May 2014 07:20 PM
You did not fix everything with a space, and you are using 'Tape 0' instead of 'Tape O'(letter v. number).
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
20 May 2014 07:23 PM
By the way, you set up the mouse and keyboard connections wrong.
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
20 May 2014 07:25 PM
I'm confused.
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
21 May 2014 12:59 PM
How can i fix it?
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
21 May 2014 01:51 PM
anyone?
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
22 May 2014 06:23 AM
Help someone ples :D?
Report Abuse
bradz234 is not online. bradz234
Joined: 02 Aug 2009
Total Posts: 31
22 May 2014 06:30 AM
Should be something like:

mouse.KeyDown:connect(function(key)
if key == "o" then
--code
elseif key == "t" then
--code
end
end)
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
22 May 2014 04:30 PM
So this?
mouse.KeyDown:connect(function(key)
if key == "o" then
--code
game.Workspace.Tape B:remove()
game.Workspace.Tape O:remove()
elseif key == "t" then
--code
local T= Instance.new('Part',game:GetService'Workspace')
t.Size=Vector3.new(1,1,1)
t.Anchored=true
t.CFrame=game:GetService'Players'.LocalPlayer.Character:FindFirstChild'Head'.CFrame
t.Transparency=.4
t.BrickColor.new'Black'
t.Name = 'Tape B'
wait(1)
t.BrickColor.new'Bright Orange'
t.Name = 'Tape O'
t.CanCollide = false
end
end)
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
22 May 2014 07:53 PM
correct?
Report Abuse
bradz234 is not online. bradz234
Joined: 02 Aug 2009
Total Posts: 31
23 May 2014 12:08 AM
Sorry for this late reply. Anyways, I am unsure of what you want to do here, so please refer to: http://wiki.roblox.com/index.php/Taking_keyboard_input
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
23 May 2014 10:47 AM
I'm wanting it to work as a tool that does those things when i press that key while having the tool equipped
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
23 May 2014 10:57 PM
Thank you for the link,
Ok so would this work or no?
I made it more basic not as many options but if i can get this to work i'm confident i can add the other functions to it as well.

local tool = script.Parent
tool.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "y" then
local T= Instance.new('Part',game:GetService'Workspace')
t.Size=Vector3.new(1,1,1)
t.Anchored=true
t.CFrame=game:GetService'Players'.LocalPlayer.Character:FindFirstChild'Head'.CFrame
t.Transparency= 0
t.BrickColor.new'Black'
t.Name = 'Tape'
t.CanCollide = false
elseif key == "t" then
game.Workspace.Tape:remove()

end
end)
end)
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
23 May 2014 10:59 PM
local tool = script.Parent
tool.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "y" then
local t= Instance.new('Part',game:GetService'Workspace')
t.Size=Vector3.new(1,1,1)
t.Anchored=true
t.CFrame=game:GetService'Players'.LocalPlayer.Character:FindFirstChild'Head'.CFrame
t.Transparency= 0
t.BrickColor.new'Black'
t.Name = 'Tape'
t.CanCollide = false
elseif key == "t" then
game.Workspace.Tape:remove()

end
end)
end)
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
25 May 2014 04:27 PM
bamp
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image