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

"bad argument #3 to 'Image' (string expected, got Object)" even though it's a string?

Asked by 4 years ago
Edited 4 years ago

Alright, so I'm making a slideshow, here's my code:

local slide1 = script.Parent.SurfaceGui.Frame.slide1
local slide2 = script.Parent.SurfaceGui.Frame.slide2
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local revent = ReplicatedStorage.ScreenEvent
local currentslide = slide1
local function test(player,currentslideid)
print(currentslideid)--Printing just to test.
local function move(obj, pos)
    obj:TweenPosition(pos, "Out", "Quad", 2)
end

while true do

    currentslide.Image = currentslideid--Right here is the issue.
    currentslide.Position = UDim2.new(-1, 0, 0, 0)
    move(currentslide, UDim2.new(0, 0, 0, 0))

    if currentslide == slide1 then
        currentslide = slide2
    else
        currentslide = slide1
    end

    move(currentslide, UDim2.new(1, 0, 0, 0))

    wait(2)

end



end


revent.OnServerEvent:Connect(test)

Whenever I run this, it gives me this error: Workspace.screen.Script:18: bad argument #3 to 'Image' (string expected, got Object) Thanks!

0
W NiniBlackJackQc 1562 — 4y

Answer this question