|
| 07 Sep 2014 12:23 AM |
while wait() do if player.pants.Value == 1 then newpants = Instance.new("Pants", player.Character) newpants.Name = "Pants" player.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=174231515" textgui2 = player.PlayerGui.GameGui.TextLabel textgui2.Visible = true textgui2.Text = "Successfully equipped blue assassin pants" wait(2) print("good") textgui2.Visible = false repeat wait() until player.pants.Value == 2 end end
This does not run even if the value is 1. |
|
|
| Report Abuse |
|
|
yankeejr
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 4906 |
|
|
| 07 Sep 2014 12:30 AM |
while wait() do if player.Pants.Value == 1 then -- CAPITAL P newpants = Instance.new("Pants", player.Character) newpants.Name = "Pants" player.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=174231515" textgui2 = player.PlayerGui.GameGui.TextLabel textgui2.Visible = true textgui2.Text = "Successfully equipped blue assassin pants" wait(2) print("good") textgui2.Visible = false repeat wait() until player.pants.Value == 2 end end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 07 Sep 2014 12:47 AM |
What type of object is 'pants'? Make sure it is defined properly.
Also, in your loop you have 'repeat wait() until player.pants.Value == 2'.
That will repeat that wait() until it actually equals 2 meaning your while wait() do loop will not run again nor anything else in the script for that matter until pants.Value == 2. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2014 12:49 AM |
| Pants is a IntValue, and I have no idea what to do to stop pants from being spammed inside the character, so I did that. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2014 12:52 AM |
On line 2, I just made a check for the PantsTemplate. If it does not equal the pantstemplate that you want, then it creates it. Otherwise if it is already there, it wont continue.
while wait(1/30) do if player['Character']['Pants'].PantsTemplate ~= "http://www.roblox.com/asset/?id=174231515" then newpants = Instance.new("Pants", player.Character) newpants.Name = "Pants" player.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=174231515" textgui2 = player.PlayerGui.GameGui.TextLabel textgui2.Visible = true textgui2.Text = "Successfully equipped blue assassin pants" wait(2) print("good") textgui2.Visible = false end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Sep 2014 12:57 AM |
| The whole thing isnt working |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2014 12:59 AM |
| That's for you to do. I don't have a place set up the way you do to test it in the proper environment. Syntax wise, the code should be fine, but you need to test it to see if it meets your needs. |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2014 01:00 AM |
| My original code didnt work, and neither did yours. I'm asking how would I fix it? |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Sep 2014 01:06 AM |
Where there any errors?
Is there by any chance that you're not removing the original pants that the player or you may have?
Try this:
while wait(1/30) do if player.Character:WaitForChild('Pants').PantsTemplate ~= "http://www.roblox.com/asset/?id=174231515" then newpants = Instance.new("Pants", player.Character) newpants.Name = "Pants" player.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=174231515" textgui2 = player.PlayerGui.GameGui.TextLabel textgui2.Visible = true textgui2.Text = "Successfully equipped blue assassin pants" wait(2) print("good") textgui2.Visible = false end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Sep 2014 01:08 AM |
| I destroyed the original shirt and there are no errors |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 07 Sep 2014 01:43 AM |
| Use the breakpoints in the code editor in studio, or make prints throughout the script to how far it is getting. |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Sep 2014 02:22 AM |
i always use boolvalues in loops, heres an example
while wait() do if game.Workspace.alreadyplayedsound.Value == false then game.Workspace.alreadyplayedsound.Value = true part = Instance.new("Part") part.Parent = Workspace end game.Workspace.FilteringEnabled = true end
idk just random example
|
|
|
| Report Abuse |
|
|