Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I'm trying to make my ImageLabel the image of the new Item added but I'm getting an error?

Asked by 6 years ago

The Error I am getting: Players.bryson467.PlayerGui.MainGui.OpenCase.Frame.LocalScript:33: bad argument #2 to '?' (string expected, got nil)

What I'm trying to do: Hello, I'm trying to make it so this ImageLabel becomes the Image of the new Limited that was added to the player, so I'm trying to change the ImageLabel image to the new item that inside of the Event thats fireing the has this code to change the ImageLabel to the Limited Image.

What I have tried: I have tried changing how i said the function, and I have tried rewording the Http Link From "http://www.roblox.com/Thumbs/Asset.ashx?Width=420&Height=420&AssetID=" TO "http://www.roblox.com/asset/?id="

local SkipAnimID = 961752739
local player=game.Players.LocalPlayer
wait()
local label=script.Parent.ImageLabel
label.Visible=true
repeat label.Size=UDim2.new(0,label.AbsoluteSize.Y,1,0) wait() until label.AbsoluteSize.Y>0
label.Visible=false

function GiveCommas(int)
local new_number=tostring(int)
local place=#new_number
while place-3>0 do
place=place-3
new_number=string.sub(new_number,1,place)..","..string.sub(new_number,place-(-1))
end
return new_number;
end

workspace.OpenCase.OnClientEvent:connect(function(t,chosen)
script.Parent.Parent.Parent.A:Play()
label.Visible=true
repeat label.Size=UDim2.new(0,label.AbsoluteSize.Y,1,0) wait() until label.AbsoluteSize.Y>0
label.Visible=false
script.Parent.Parent.Visible=true
script.Parent.Parent.Parent.Buttons.Visible=false
script.Parent.Parent.Parent.Cases:TweenPosition(UDim2.new(0.2,0,1,0),nil,nil,nil,true)
script.Parent.Position=UDim2.new(0,0,0.25,0)
for i,v in next,t do
local nl=label:Clone()
nl.Parent=script.Parent
nl.Name=v.Name
nl.Image='http://www.roblox.com/Thumbs/Asset.ashx?Width=420&Height=420&AssetID='..v.Name
script.Parent.Parent.Parent.YouWon.ImageLabel.Image = 'http://www.roblox.com/asset/?id='..workspace.Limiteds[t.chosen].Name
nl.Position=UDim2.new(0,nl.AbsoluteSize.X*(i-1),0,0,0)
nl.Visible=true
if v.Value==100000 then
nl.BackgroundColor3=BrickColor.new("Alder").Color
elseif v.Value>=100000 then
nl.BackgroundColor3=BrickColor.Yellow().Color
elseif v.Value>=50000 then
nl.BackgroundColor3=Color3.new(1,0,0)
elseif v.Value>=10000 then
nl.BackgroundColor3=Color3.new(0,1,0)
end
end
wait(1)
local move=-chosen*(label.AbsoluteSize.Y)+math.random(label.AbsoluteSize.Y)+(script.Parent.Parent.Pointer.AbsolutePosition.X+6)
script.Parent:TweenPosition(UDim2.new(0,move,0.25,0),nil,nil,7)
game.Players.PlayerAdded:connect(function(player)
    if game:GetService("MarketplaceService"):PlayerOwnsAsset(player,SkipAnimID) then
    wait(0) 
    else
        wait(10)
    end
end)
script.Parent.Parent.Parent.YouWon.ItemName.Text=string.upper(game:GetService("MarketplaceService"):GetProductInfo(t[chosen].Name).Name)
if script.Parent.Parent.Parent.YouWon:FindFirstChild("Frame") then
script.Parent.Parent.Parent.YouWon.Frame:Destroy()
end
script.Parent.Parent.Parent.YouWon.TextLabel.Text=GiveCommas(workspace.Limiteds[t[chosen].Name].Value)..' CASE-BUX'
script.Parent.Parent.Parent.YouWon.Visible = true
script.Parent.Parent.Visible = false
script.Parent.Parent.Parent.YouWon.SellButton.MouseButton1Click(function()
    game.Workspace.GiveRobux:FireServer(workspace.Limiteds[t[chosen].Name].Value)
    script.Parent.Parent.Parent.YouWon.Visible = false
end)
script.Parent.Parent.Parent.OpenCase.Visible = false
for i,v in next,script.Parent:GetChildren() do
if v~=script and v.Name~='ImageLabel' then
v:Destroy()
end
end
script.Parent.Parent.Parent.Buttons.Visible = true
end)
0
You have t and chosen as your parameters but are also saying t.chosen on line 33. The script is trying to find t in chosen and also the parameter t in chosen, which is causing a confusing lookup in your code and returning nil. Azarth 3141 — 6y
0
How do I fix it? Bryson467 12 — 6y

Answer this question