KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 10 May 2015 05:28 AM |
SelectedTank.Value = OwnedTanks[TankButton.Name] print(TankButton.Name, SelectedTank.Value)
the tankbutton's name is "TestTank" yet the print gives me "TestTank3" for each one. what what what. I suppose you would need this too, which is how i created it.
for i = 1, #Tanks do if Tanks[i].Name == SelectedTank.Value.Name then--dont show selectedtank TankSkipped = true print("Skipped: "..Tanks[i].Name) else TankButton = Instance.new("TextButton") TankButton.Parent = TankListFrame TankButton.Size = UDim2.new(1,0,0,20) if TankSkipped then TankButton.Position = UDim2.new(0,0,0,(i * 20)-40) else TankButton.Position = UDim2.new(0,0,0,(i * 20)-20) end TankButton.BackgroundColor3 = Color3.new(0,0,0) TankButton.BackgroundTransparency = 1 TankButton.BorderSizePixel = 0 TankButton.Font = "SourceSansBold" TankButton.FontSize = "Size18" TankButton.TextColor3 = Color3.new(1,1,1) TankButton.TextXAlignment = "Left" TankButton.Text = Tanks[i].Name TankButton.Name = Tanks[i].Name end |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
| |
|
|
| 10 May 2015 06:55 AM |
You're missing an end.
Is SelectedTank an object value? If not.. Why are you using: "SelectedTank.Value.Name"
print("Skipped: "..Tanks[i].Name) If it keeps printing this.. You're always getting Tanks[3] because SelectedTank is what's causing this. |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 10 May 2015 07:10 AM |
"You're missing an end."
this isnt the whole script, and i would be getting an error. |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 11 May 2015 05:18 AM |
| so i would have to change selectedtank(object value) to a string? |
|
|
| Report Abuse |
|
|
|
| 11 May 2015 06:23 AM |
Use tostring(variable)
It converts any type of data to a string |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 12 May 2015 05:19 AM |
so i should switch it to a string ok |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 12 May 2015 05:32 AM |
heres the full function because i changed everything and it still doesnt work
function SwitchTank() if GarageFrame:FindFirstChild("TankList") then GarageFrame:FindFirstChild("TankList"):Destroy() else Tanks = OwnedTanks:GetChildren() TankListFrame = Instance.new("ScrollingFrame") TankListFrame.Parent = GarageFrame TankListFrame.Size = UDim2.new(0,200,0,200) TankListFrame.Position = UDim2.new(0.5,-100,0.5,-100) TankListFrame.CanvasSize = UDim2.new(0,0,0,(#Tanks * 20)) TankListFrame.BackgroundColor3 = Color3.new(0,0,0) TankListFrame.BackgroundTransparency = 0.5 TankListFrame.BorderSizePixel = 0 TankListFrame.Name = "TankList"
local TankSkipped = false for i = 1, #Tanks do if Tanks[i].Name == tostring(SelectedTank.Value) then TankSkipped = true print("Skipped: "..Tanks[i].Name) else TankButton = Instance.new("TextButton") TankButton.Parent = TankListFrame TankButton.Size = UDim2.new(1,0,0,20) if TankSkipped then TankButton.Position = UDim2.new(0,0,0,(i * 20)-40) else TankButton.Position = UDim2.new(0,0,0,(i * 20)-20) end TankButton.BackgroundColor3 = Color3.new(0,0,0) TankButton.BackgroundTransparency = 1 TankButton.BorderSizePixel = 0 TankButton.Font = "SourceSansBold" TankButton.FontSize = "Size18" TankButton.TextColor3 = Color3.new(1,1,1) TankButton.TextXAlignment = "Left" TankButton.Text = Tanks[i].Name TankButton.Name = Tanks[i].Name end end for _, Button in pairs(TankListFrame:GetChildren()) do Button.MouseButton1Click:connect(function() Garage:WaitForChild("Tank"):ClearAllChildren() SelectedTank.Value = tostring(TankButton.Name) print(TankButton.Name, SelectedTank.Value) Tank = OwnedTanks[tostring(SelectedTank.Value)]:Clone() Tank.Parent = Garage:WaitForChild("Tank") Tank.PrimaryPart = Tank:WaitForChild("Hull") Tank:SetPrimaryPartCFrame(Garage:WaitForChild("Podium").CFrame + Vector3.new(0,2,0)) Tank:WaitForChild("Turret").BottomSurface = "Weld" Tank:WaitForChild("Hull").TopSurface = "Smooth" Tank:MakeJoints() TankListFrame:Destroy() UpdateGuis() end) end end end
i am NOT getting any errors |
|
|
| Report Abuse |
|
|
KingJacko
|
  |
| Joined: 20 Jun 2008 |
| Total Posts: 3944 |
|
|
| 13 May 2015 05:23 PM |
i changed SelectedTank to StringValue and used the about script.
I really need help.
All i need to know is the problem |
|
|
| Report Abuse |
|
|