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: What's wrong with this script?

Previous Thread :: Next Thread 
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 09:58 PM
game.Players.PlayerAdded:connect(function(plyr)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(p, 120430560) then
--MAKE SURE THE NUMBERS ARE THE ID OF THE SHIRT
local a = game.Lighting:FindFirstChild("Flashlight")
if a then
a:Clone().Parent = plyr.StarterPack
end
end
end)

It doesn't work, nothing in the output about it.

It's supposed to give anyone who owns the T-shirt a gear in a model called "Flashlight" from the lighting.

Minions, UNITE!
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 09:59 PM
btw, the guy who made it for me (I didn't make it) is offline, so I have to ask you guys.

Minions, UNITE!
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
25 Jun 2013 10:00 PM
game.Players.PlayerAdded:connect(function(plyr)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plyr, 120430560) then
--MAKE SURE THE NUMBERS ARE THE ID OF THE SHIRT
local a = game.Lighting:FindFirstChild("Flashlight")
if a then
a:Clone().Parent = plyr.StarterPack
end
end
end)
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:01 PM
*facepalm*
I see what the problem was
Thanks!

Minions, UNITE!
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:02 PM
Wait, that doesn't work either.

Minions, UNITE!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 10:06 PM
"if game:GetService("MarketplaceService"):PlayerOwnsAsset(p, 120430560) then"

p is suppose to be plyr


"a:Clone().Parent = plyr.StarterPack"

Player does NOT have StarterPack as it's child, but instead have Backpack, StarterGear, and PlayerGui.

Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:17 PM
Thanks. So I change the starterpack to startergear?

Minions, UNITE!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 10:18 PM
Experimenting is the key to scripting.
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
25 Jun 2013 10:19 PM
StarterGear is for when you want players to spawn with the tool over and over. Backpack is for when you want players to have the tool until they die, then they will lose it.
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:22 PM
@luv
I know the difference between starter/backpack, but thanks for trying to help.
Also, what does this mean in the output?

20:18:43.996 - DataModel Loading http://www.roblox.com/asset/?id=85438841
20:19:46.252 - Character is not a valid member of DataModel
20:19:46.261 - Script "Workspace.Distribute", Line 4
20:19:46.261 - stack end

The "Character is not a valid member of DataModel" is in red, what in the world does that mean? (I hope this isn't a super basic thing I should know)

Minions, UNITE!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 10:28 PM

"20:19:46.252 - Character is not a valid member of DataModel"
Character is not a child of the Model or whatever DataModel is.

"20:19:46.261 - Script "Workspace.Distribute", Line 4""
The error happened on line 4 of a script named "Distribute" that is located in Workspace.
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:41 PM
Thanks, the script wasn't anything important so I just got rid of it.

Minions, UNITE!
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:46 PM
I tried both starter and backpack, they didn't work.
Can anyone fix it, or make an entirely new script?

I'm trying to get a gear for a person who has a VIP T-shirt.

Minions, UNITE!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 10:48 PM
game.Players.PlayerAdded:connect(function(plyr)
plyr:WaitForDataReady()
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plyr, 120430560) then
local a = game.Lighting:FindFirstChild("Flashlight")
if a then
a:Clone().Parent = plyr.StarterGear
a:Clone().Parent = plyr.Backpack
end
end
end)

Try that.
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:50 PM
Thanks.

Also, why is it that when I offer a reward here, I get ignored/told to get out, but when I don't, I get help?

Minions, UNITE!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 10:52 PM
Bribing and requesting are things that Scripting Helpers hate, lol.

Plus, when a person say they would reward someone to do something, they never give the reward.
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 10:55 PM
Oh.
Anyways, for some reason your script didn't work.
Should it have been a local script?
Also, your'e making it so the person just has to own the T-shirt, not wear it right?

I have it as a regular script in the workspace, with a model called "Flashlight" in the Lighting with the flashlight gear inside it.

Anything wrong with what I'm doing? Nothing came out in the output, either.

Minions, UNITE!
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
25 Jun 2013 11:06 PM
"with a model called "Flashlight" in the Lighting with the flashlight gear inside it."

The script clones the model and the model inside have a tool.
Since the tool's parent isn't Backpack, the tool is not showing up on your screen.


game.Players.PlayerAdded:connect(function(plyr)
plyr:WaitForDataReady()
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plyr, 120430560) then
local a = game.Lighting:FindFirstChild("Flashlight")
if a then
for _,v in pairs(a:GetChildren()) do
if v:IsA("Tool") or v:IsA("HopperBin") then
local aa = v:Clone()
aa.Parent = plyr.StarterGear
aa.Parent = plyr.Backpack
end
end
end
end
end)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
25 Jun 2013 11:10 PM
You just reparented the clone, so it wouldn't appear in StarterGear anymore.

for _,v in pairs(a:GetChildren()) do
if v:IsA("Tool") or v:IsA("HopperBin") then
v:Clone().Parent = plyr.StarterGear
v:Clone().Parent = plyr.Backpack
end
end
Report Abuse
kazagent is not online. kazagent
Joined: 18 Apr 2009
Total Posts: 2117
25 Jun 2013 11:11 PM
THANKS IT WORKED!

Off topic, but when I was clicking around in this forum to pass time, my head started spinning when I tried to read some scripts that people had trouble with.
I'm clearly incapable of scripting, qq.

Minions, UNITE!
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