Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a gui that inserts a decal that you want into a cape?

So I have the cape ready but I'm needing it for when you put a decal ID in it will show up on the cape. My script currently is this

local character = game.Players.LocalPlayer.Name local plr = game.Workspace:FindFirstChild(character) local cape = plr:FindFirstChild("Cape") script.Parent.FocusLost:connect( function(enterPressed) if enterPressed then cape.Decal.Texture = "rbxassetid://"..script.Parent.Text print("Decaled") end end)

I keep getting a nil value ( I know that this is in a local script so it wont fully work but ill figure it out later) If anyone could help me that would be amazing

1 answer

After much more time experimenting with this than I am willing to admit, I have come to the conclusion that the problem isn't the script, it is the decal. The way that I got around the error was by using a texture instead of a decal. I also had to add a WaitForChild() because you were making the variable too quickly and you never had cape set correctly anyway. With these two changes your script would look like this:

local character = game.Players.LocalPlayer.Name 
local plr = game.Workspace:FindFirstChild(character) 
local cape = plr:WaitForChildChild("Cape") 

script.Parent.FocusLost:Connect( function(enterPressed) 
	if enterPressed then 
		cape.Texture.Texture = "http://www.roblox.com/asset/?id=".. script.Parent.Text
	end
end)

If you didn't notice, I also had to change the beginning to the Texture id. Instead of "rbxasset://", I had to use "http://www.roblox.com/asset/?id=". I'm unsure of the reasoning behind this, but I'm sure if you search the wiki you can figure out why. Don't hesitate to comment any questions you might have. Hope I helped!

1 comment

0

Alright, thank you. The only thing I could find was from here from 6 years ago.

This discussion is preserved as it was. New answers, comments, and votes are closed.