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: Attempt to call local "Name" (a string value)

Previous Thread :: Next Thread 
rarecoolkid1000 is not online. rarecoolkid1000
Joined: 22 May 2011
Total Posts: 38
14 Apr 2016 09:10 PM
So I'm having this problem and I just can't figure out what I'm doing wrong. Basically, I have a brick that will change them name of a tool. For example, if the tool is called "x" and you touch the brick with the tool, the tool will be changed to "x, y"

Here's the script:

function tch(h)
if h.Parent.ClassName == "Tool" then
if h.Parent.Name == "Sauce" then
h.Parent.Name = "P"
h.Parent.Pepperoni.Transparency = 0
else
if h.Parent.Name ~= "Dough" or "Sauce" then
local name = h.Parent.Name
h.Parent.Name = (name ", P")
h.Parent.Pepperoni.Transparency = 0
end
end
end
end


script.Parent.Touched:connect(tch)
Report Abuse
climethestair is online. climethestair
Joined: 01 Mar 2011
Total Posts: 133
14 Apr 2016 09:51 PM
h.Parent.Name = (name ", P") is incorrect, it should be:

h.Parent.Name = (name, "P")


Also, the if h.Parent.Name ~= "Dough" or "Sauce" then should be:

if h.Parent.Name ~= "Dough" or h.Parent.Name ~= "Sauce" then


#code while true do end
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
14 Apr 2016 10:06 PM
clime you can not concat 2 strings with a comma

h.Parent.Name = name .. "P"


Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
15 Apr 2016 01:44 AM
script.Parent.Touched:connect(function(hit)
if hit.Parent:IsA("Tool") then
if hit.Parent.Name == "Sauce" then
hit.Parent.Name = "P"
hit.Parent.Pepperoni.Transparency = 0
else
if hit.Parent.Name ~= "Dough" or hit.Parent.Name ~= "Sauce" then
hit.Parent.Name = hit.Parent.Name..", P"
hit.Parent.Pepperoni.Transparency = 0
end
end
end
end)


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