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 » Scripters
Home Search
 

Re: ###################

Previous Thread :: Next Thread 
Tagap1234 is not online. Tagap1234
Joined: 14 Jul 2012
Total Posts: 182
10 Jan 2017 03:12 PM
Hello, guys.

Here's an example of a working hat giver script:

local up = Vector3.new()
local forward = Vector3.new()
local pos = Vector3.new()
local right = Vector3.new()
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = script.Parent.Name
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1,2,2)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new(0, 0, -1)
h.AttachmentPos = Vector3.new(0, 1.5, -0.05)
h.AttachmentRight = Vector3.new(1, 0, 0)
h.AttachmentUp = Vector3.new(0, 1, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)

If you try that script, whenever you touch that part that gives you the hat, you'll be able to wear as many hats as you want.

So I'd like to know how I could add an "Anti-Spam" thing into this script.

Any help would be appreciated.


Report Abuse
Inductive is not online. Inductive
Joined: 28 May 2012
Total Posts: 6480
10 Jan 2017 03:16 PM
Couldn't you just check the number of hats in the character that touched the part? You could use that to set a limit at three, or five or whatever you want.
Report Abuse
Tagap1234 is not online. Tagap1234
Joined: 14 Jul 2012
Total Posts: 182
11 Jan 2017 07:57 AM
How could I?
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
11 Jan 2017 08:33 AM
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true and (not hit.Parent:FindFirstChild(script.Parent.Name))) then


Report Abuse
Tagap1234 is not online. Tagap1234
Joined: 14 Jul 2012
Total Posts: 182
11 Jan 2017 12:04 PM
Thank you!


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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