|
| 06 Mar 2013 08:18 PM |
I am an intermediate scripter, and I have ran into some errors, I am not all that familiar with GUIs.
The output says nothing, here's the script:
Re: Gui Posted: 03-06-2013 02:59 PM Edited it..
VLA = game.Lighting:findFirstChild("Vampire Left Arm") VLL = game.Lighting:findFirstChild("Vampire Left Leg") VRA = game.Lighting:findFirstChild("Vampire Right Arm") VRL = game.Lighting:findFirstChild("Vampire Right Leg") VT = game.Lighting:findFirstChild("Vampire Torso")
VampireSet = {VLA,VLL,VRA,VRL,VT}
_Vampire = script.Parent game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(person) function vampire() for _,morph1 in pairs (person:GetChildren()) do
if morph1[i]:IsA("Humanoid") and morph1[b]:IsA("CharacterMesh") then meshvalue = Instance.new("IntValue",person) meshvalue.Value = 1
wait(6)
meshvalue.Value = 0
morph1[b]:remove() VampireSetClone = VampireSet:clone() wait(5)
VampireSetClone.Parent = person
elseif morph1[i]:IsA("Humanoid") then
meshvalue = Instance.new("IntValue",person) meshvalue.Value = 1
morph1[b]:remove()
meshvalue.Value = 0
else print("Not a humanoid")
end
end end
script.Parent.MouseButton1Click:connect(vampire)
end) end)
Replies would be appriciated.
|
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 08:20 PM |
| Sorry for the beginning, I copied and pasted from my other thread. |
|
|
| Report Abuse |
|
|
Lombardo3
|
  |
| Joined: 15 Dec 2012 |
| Total Posts: 271 |
|
|
| 06 Mar 2013 08:24 PM |
| It would help if you told us what are you trying to do. |
|
|
| Report Abuse |
|
|
Lombardo3
|
  |
| Joined: 15 Dec 2012 |
| Total Posts: 271 |
|
|
| 06 Mar 2013 08:29 PM |
| You see, when the output doesn't say anything, it's because there are no errors, the probability is that the script is following a different branch from the one you expected. So and a bunch of prints to see what executes and what doesn't, and to see the data. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 08:47 PM |
Sorry, it must've slipped my mind to include that info.
I'm trying to have a GUI morph for a vampire.
I added the prints, and it prints "Line 9" twice on entered, and prints nothing when I click on the vampire button that should morph me.
Line 9 is a global variable declaration, and it shouldn't error.
Line 9 is also the line before I declare my functions, meaning it has the most likelihood not to print anything after that.
|
|
|
| Report Abuse |
|
|
Lombardo3
|
  |
| Joined: 15 Dec 2012 |
| Total Posts: 271 |
|
|
| 06 Mar 2013 09:02 PM |
Wait a minute, is the script.Parent a GuiButton?, If yes, then that's the problem. The GUIs in StarterGui are deleted everytime the character dies and added to the character when it spawns, so when the player spawn, the script is executed, the event listener is set, but the player has already entered and spawned, so it will never execute for that player. Just try:
repeat wait() until game.Players.LocalPlayer.Character --Just in case
VLA = game.Lighting:findFirstChild("Vampire Left Arm") VLL = game.Lighting:findFirstChild("Vampire Left Leg") VRA = game.Lighting:findFirstChild("Vampire Right Arm") VRL = game.Lighting:findFirstChild("Vampire Right Leg") VT = game.Lighting:findFirstChild("Vampire Torso")
VampireSet = {VLA,VLL,VRA,VRL,VT}
person = game.Players.LocalPlayer.Character
function vampire() for _,morph1 in pairs (person:GetChildren()) do
if morph1[i]:IsA("Humanoid") and morph1[b]:IsA("CharacterMesh") then meshvalue = Instance.new("IntValue",person) meshvalue.Value = 1
wait(6)
meshvalue.Value = 0
morph1[b]:remove() VampireSetClone = VampireSet:clone() wait(5)
VampireSetClone.Parent = person
elseif morph1[i]:IsA("Humanoid") then
meshvalue = Instance.new("IntValue",person) meshvalue.Value = 1
morph1[b]:remove()
meshvalue.Value = 0
else print("Not a humanoid")
end
end end
script.Parent.MouseButton1Click:connect(vampire)
|
|
|
| Report Abuse |
|
|
|
| 06 Mar 2013 09:34 PM |
I edited the script around a bit, I am now at it's compressed form.
I get this one error when I click the button (none when I play solo)
Players.Player1.PlayerGui.ChooseGui.Background.Vampire.Scri:19: bad argument #2 to '?' (string expected, got nil)
I can't seem to find an issue on line 19, it's the line where it says "if morph1[b]:IsA("CharacterMesh") then" This is the compressed script:
repeat wait() until game.Players.LocalPlayer.Character --Just in case
VLA = game.Lighting:findFirstChild("Vampire Left Arm") VLL = game.Lighting:findFirstChild("Vampire Left Leg") VRA = game.Lighting:findFirstChild("Vampire Right Arm") VRL = game.Lighting:findFirstChild("Vampire Right Leg") VT = game.Lighting:findFirstChild("Vampire Torso")
VampireSet = {VLA,VLL,VRA,VRL,VT}
person = game.Players.LocalPlayer.Character
function vampire() for _,morph1 in pairs (person:GetChildren()) do if morph1[b]:IsA("CharacterMesh") then morph1[b]:Destroy() --Gets rid of all pre-existing character meshes (packages)
if morph1[i]:IsA("Humanoid") then meshvalue = Instance.new("IntValue",person) meshvalue.Value = 1
wait(6)
meshvalue.Value = 0 VampireSetClone = VampireSet:clone() wait(5)
VampireSetClone.Parent = person
else print("Not a humanoid")
end end
end
end
script.Parent.MouseButton1Click:connect(vampire)
--[[P.S.
I try to work errors and bugs out as much to my own extent I can, before I post.]] |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Lombardo3
|
  |
| Joined: 15 Dec 2012 |
| Total Posts: 271 |
|
| |
|
|
| 07 Mar 2013 03:10 PM |
What do you mean by defining that?
I'm trying to make a random statment, I suspected I was wrong with that, how do I fix such a thing? |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 03:15 PM |
There are syntax errors and user errors. Syntax errors are found by your compiler/interpreter while user errors are only found by debugging your code.
Here is an example of a user error:
variableAssigned = "I don't want to print this string."
do local variableAssigned = "I want to print this string." end
print(variableAssigned) --> I don't want to print this string.
That executes correctly without any syntax errors, but doesn't do what you want. |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2013 04:35 PM |
| Okay, thanks for the explination, I knew that, but thanks anyways, but it didn't help much with my question. |
|
|
| Report Abuse |
|
|
| |
|
|
| 07 Mar 2013 04:59 PM |
Bump.
I also tried a localscript, same error. |
|
|
| Report Abuse |
|
|