I’m making a GamePass where you can have a custom image trail, how it works is you put the decal id link into the Textbox then click accept. But every time I try to put the link inside it doesn’t work.
The script definitely works, it does indeed set the link to the texture, but it doesn’t show the image…
-- client
script.Parent:WaitForChild("Accept").MouseButton1Click:Connect(function()
if Slow == true then
else
Slow = true
-- script.Trail:FireServer( decal link you put ,gamepassID)
script.Trail:FireServer(script.Parent:WaitForChild("TextBox").Text,10483733)
wait(2)
Slow = false
end
end)
-- server
local MS = game:GetService('MarketplaceService')
script.Parent.OnServerEvent:Connect(function(Player,DecalID,GamepassID)
if MS:UserOwnsGamePassAsync(Player.UserId, GamepassID) then
local Character = Player.Character
Character.HumanoidRootPart.Trail.Texture = (DecalID)
end
end)
Yes, the system is set up so the player just puts in an ID like audios for example, and the script will automatically concatenate it with “http://www.roblox.com/asset/?id=” which is the default path for any texture. Even when I put the texture in with studio itself it auto updates to this string with the ID at the end of it… I’m slightly confused on why it isn’t working. Here’s my server script.
ChangeTextureEventPortal.OnServerEvent:Connect(function(Player, TextureNumber)
local NewTextureId = TextureNumber
local Character = workspace[Player.Name]
if Player.Backpack:FindFirstChild("Lucky Numberator") then
local LuckyNumberator = Player.Backpack:FindFirstChild("Lucky Numberator")
local LuckyNumberatorHandle = LuckyNumberator.Handle
local TexturesToChange = LuckyNumberatorHandle:GetChildren()
if LuckyNumberatorHandle:FindFirstChild("Texture") then
for i, v in pairs(TexturesToChange) do
if v:IsA("Texture") then
v:Destroy()
end
end
end
local Texture1 = Instance.new("Texture", LuckyNumberatorHandle)
local Texture2 = Instance.new("Texture", LuckyNumberatorHandle)
Texture1.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
Texture2.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
Texture1.Face = "Top"
Texture2.Face = "Bottom"
else
-- do nothing
end
if Character:FindFirstChild("Lucky Numberator") then
local LuckyNumberator = Character:FindFirstChild("Lucky Numberator")
local LuckyNumberatorHandle = LuckyNumberator.Handle
local TexturesToChange = LuckyNumberatorHandle:GetChildren()
if LuckyNumberatorHandle:FindFirstChild("Texture") then
for i, v in pairs(TexturesToChange) do
if v:IsA("Texture") then
v:Destroy()
end
end
end
local Texture1 = Instance.new("Texture", LuckyNumberatorHandle)
local Texture2 = Instance.new("Texture", LuckyNumberatorHandle)
Texture1.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
Texture2.Texture = "http://www.roblox.com/asset/?id="..NewTextureId
Texture1.Face = "Top"
Texture2.Face = "Bottom"
else
-- do nothing
end
end)
Let me know if this works - it’s a sample code, so you’d have to arrange it appropriately, which should be simple, as you’d need to utilise TextureNumber then :LoadAsset():
local ins = game:GetService("InsertService") --obtaining service (Script only)
ChangeTextureEventPortal.OnServerEvent:Connect(function(Player, TextureNumber)
local textureId = ins:LoadAsset(TextureNumber):GetChildren()[1].Texture
--now textureId can be used as .Texture
end)
Hey, I’m running into a minor error when players try to use their own textures, it seems to just fail, and say it’s not trusted. Afterwards, it just temp read errors.
Any ideas? Other games have pulled this off, and even Adonis Donation Commands have with particles and capes as well
I’m a little confused on how I would incorporate this, and what difference does it make with the way I’m doing it? This just seems to be retrieving product information…
Alright - I figured out that it won’t work unless if the inputted ID is created by you, therefore, throwing an HTTP 403 error. I don’t presume it’s possible to achieve another Decal from the library with this method.