Can't upload a photo in a Texture

hi, I was working at an Ad Sistem, but there is a problem with the part of showing the ad. If I want to put it manually it works, but when I want a script to put it this error appears:

RobloxStudioBeta_swGmggaH9u

the id is same and if u put it manually or with a script:

RobloxStudioBeta_XR6Sfn391P

what supposted to show:

RobloxStudioBeta_42ftjHepLH

what is showing:

RobloxStudioBeta_CxRIgDhDqA

1 Like

@briana_superstar Maybe try posting the link into a decal and get the rbxassetid:// of the decal instead.

still don’t work, the dacal link: https://www.roblox.com/library/4214656220/Images-brawl-stars-artwork-ios-promo-pic-1-1

@briana_superstar Could you share the code you are using?

ok, the saving code:


function AdService:AddAd(price,id,timeStamp,Time)
	local formatData = {price,id,timeStamp,Time}
	local receivedData = AdStore.VideoSaving:GetAsync('VideoSavingKey3')
	if receivedData ~= nil then	
	receivedData = game.HttpService:JSONDecode(receivedData)
	receivedData[tonumber((#receivedData) + 1)] = formatData
	receivedData = game.HttpService:JSONEncode(receivedData)
	AdStore.VideoSaving:SetAsync('VideoSavingKey3',receivedData)
	else
	receivedData = {}
	receivedData[tonumber((#receivedData) + 1)] = formatData
	receivedData = game.HttpService:JSONEncode(receivedData)
	AdStore.VideoSaving:SetAsync('VideoSavingKey3',receivedData)
	end
end

the Showing function:

function ShowAd(Holder)
	local Ad = Holder:WaitForChild('Ad')
	if #ServiceFunctions:GetVideos() >= 1  then
		if Ad:IsA('Decal') or Ad:IsA("Texture") then
			Ad.Texture = tostring(GetRandomAd('Decal'))
		elseif Ad:IsA('ImageButton') or Ad:IsA('ImageLabel') then
			Ad.Image = tostring(GetRandomAd('Gui'))
		end
	end
end
1 Like

Can you make sure if Http requests are enabled on the game?

yes, a photo:

RobloxStudioBeta_mr75ITpI2Y

but this isn’t the problem, the problem is the photo is only white

Change the Texture.Texture property instead of loading an asset onto the texture object itself.

but this Change the Texture.Texture


Ad.Texture = GetRandomAd('Decal')

but this appears:

RobloxStudioBeta_swGmggaH9u

i don’t know what the problem was, but now it works

2 Likes

Good to hear that its working now :slightly_smiling_face:

1 Like