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: Can anyone explain why this isn't working?

Previous Thread :: Next Thread 
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:25 PM
debounce = true

function click()
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0,0.4,0)
wait(5) debounce = true
end
end

script.Parent.ClickDetector.MouseClick:connect(click)

---------

It's supposed to give you a hat when you clicki. Output states that in

if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true)
Hit is not specified.

This was originally used with touch. Now I would like to change it with click. Can anyone help?
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:27 PM
I think I see the problem...
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:29 PM
Ugh, never mind.
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
23 Jan 2013 09:29 PM
function click(hit)
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:31 PM
@Crou

Tried that earlier. Still not working.
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:34 PM
Bump.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
23 Jan 2013 09:35 PM
Assuming this worked with the .Touched version:

function click(player)
char = player.Character
if (char:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Position = char:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = char
h.AttachmentPos = Vector3.new(0,0.4,0)
wait(5) debounce = true
end
end

script.Parent.ClickDetector.MouseClick:connect(click)
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:43 PM
It still won't work.

No output either.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
23 Jan 2013 09:46 PM
Try this. Also, you set the size of the part to -0,-0,-1. That'll just revert to .2,.2,.2, the minimum brick dimensions.

function click(player)
char = player.Character
if (char:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Position = char:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = char.Head
h.AttachmentPos = Vector3.new(0,0.4,0)
wait(5) debounce = true
end
end

script.Parent.ClickDetector.MouseClick:connect(click)
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 09:54 PM
Still not working :/

Dang it...
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
23 Jan 2013 09:58 PM
debounce = true

function click(player)
char = player.Character
if (char:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat"
p.Parent = h
p.Position = char:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = char.Head
h.AttachmentPos = Vector3.new(0,0.4,0)
wait(5) debounce = true
end
end

script.Parent.ClickDetector.MouseClick:connect(click)
Report Abuse
RoScripts is not online. RoScripts
Joined: 27 Oct 2012
Total Posts: 1824
23 Jan 2013 10:41 PM
Sorry for the late response.

And it worked.

Thank you so much.

If there's anything I could help you in, message me.

I do all types of graphic designs.
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