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: Script isn't working.

Previous Thread :: Next Thread 
BaconSoap is not online. BaconSoap
Joined: 12 Sep 2010
Total Posts: 1882
08 Jun 2014 11:32 AM
local enabled = true

if enabled == true then
script.Parent.BrickColor = BrickColor.new("Bright green")
elseif enabled == false then
script.Parent.BrickColor = BrickColor.new("Bright red")
end

script.Parent.Touched:connect(function(hit)
if hit.Parent and GetPlayerFromCharacter(hit.Parent) and enabled == true then
local dogehat = Instance.new("Hat")
local dogehathandle = Instance.new("Part")
local dogehatmesh = Instance.new("SpecialMesh")
dogehatmesh.Scale = Vector3.new(2,2,2)
dogehatmesh.MeshId = "http://www.roblox.com/asset/?id=151778863"
dogehatmesh.TextureId = "http://www.roblox.com/asset/?id=151778895"
dogehathandle.Name = "Handle"
dogehathandle.Anchored = false
dogehathandle.Parent = dogehat
dogehat.Parent = hit.Parent
wait(2)
end
end)

They're just not receiving the hat on touch.
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
08 Jun 2014 11:34 AM
This line:

if hit.Parent and GetPlayerFromCharacter(hit.Parent) and enabled == true then

Should be like this:

if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) and enabled == true then
Report Abuse
BaconSoap is not online. BaconSoap
Joined: 12 Sep 2010
Total Posts: 1882
08 Jun 2014 11:41 AM
Thanks!

I wasn't all that familiar with GetPlayerFromCharacter method.
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