How would i implement knife skins into my game?

So, me and my friend are making a bhop game, and would like to implement knife skins kind of like csgo, so players can hop around and have fun with them. The problem is, idk how to do this. And you get the gun skins by buying them with “bobux” (our in game money currency to buy things in shop). Any help? you can help me find a solution in comments or dm me on discord at ggmatthew#9446. Any help will be appreciated. :slight_smile: and here is link to game Bhop "physics test" - Roblox

2 Likes

You mean, a knife 3d model, and being able to change the texture?
The user buy a new texture from ur store and applied to his knife?

Sorry maybe I misunderstood :v

More info would be very helpful, we can’t read minds :slightly_smiling_face:
I assume you have a meshpart knife, but again I need more info.
To apply textures to a knife you can just take something like this image
image
and have a dictionary of textures and just set your knife meshpart to the texture.
example:

local textures = {
KnifeTexture0 = "rbxassetid://00000",
}
Knife.TextureId = textures["KnifeTexture0"]

If that doesn’t work, you can use a texture instance on every side of the parts you are using instead, and if that doesn’t work, you can use a decal on every side of the parts you are using.

If you’re trying to apply a texture/decal to the knife and the knife has multiple parts, you can create a table that has all of the names of the faces of a part (Top,Bottom,Back,etc.), then run through all of the parts of the knife using a for loop then run through the table of faces also using a for loop.

Once you’ve done that you apply the texture/decal to the all of the faces of that part. Here’s some code to reference off of:

for i,part in pairs(Knife:GetChildren()) do			
	local faces = {
		Top = false,
		Bottom = false,
		Back = false,
		Front = false,
		Right = false,
		Left = false
	}
						
	for i,v in pairs(faces) do
		local decal = --Decal Location
		local faceToPutOn = i
		decal.Face = Enum.NormalId[faceToPutOn]
		decal.Parent = part
	end
end

Hope this helped!

Hey there! Your post is very vague and you made no attempt to solve the problem, you can’t request scripts, and you need to make some effort to solve the problem on your own.

Since I don’t know how your game’s system I’ll more go over the breakdown of what you’ll probably need to implement a shop system.

First you’ll need to create a shop system that will show the available items for the player to purchase. If you are doing a skin crate system it would be a shop showing crates and a description of their drops. In more technical speak the shop will be populated with crate objects which will hold a description and potential drop properties.

When the player makes a request to purchase the crate, you’ll of course need to make sure they have sufficient funds to purchase a crate. I’ve dug around and found this loot crate tutorial crate spin system posted by @ForeverHD which should be a good read for this topic!

To summarize just breakdown the components you need to have to make this work. Shop system(a module to handle populating the shop with skins or crates available to purchase), a purchase verification module (a system to handle purchase requests and verify the players funds for the purchase), and a safe system (a module to store the players purchase in a datastore tied to the player so their purchase isn’t lost)

I don’t personally have much experience with shops but I try to break down a project into small topics that I can look into, hope this helps even a little!

yeah, thats exactly what I mean. I don’t really know how to do things like put textures and stuff into my 3d knife model.

1 Like

Thank you very much for this breakdown I very much needed :slight_smile:

1 Like

Yeah, what i meant to say was how do i add texures in game. ;~; i’ve never ddone this before so, im in need of some help.

1 Like

Hiwiwi :3

Well all ideas that users told you are a good way to start.

You already have the knives? Those are mesh 3d models made by external software like Blender? Or the knives are Roblox Parts?

I would go with this approach:
1.- Create some knives using blender
2.- Create UV maps and texturize them as you want
3.- Create the “store” and set the textures using MeshPart.TextureID = “yourTextureID”

I think that creating your own knives with blender(or any software u want) will give you more flexibility for shapes and cool knives, using UV maps and custom textures made by you using photoshop or any software you like will give it amazing look to the wepns.

The Store system, and GUI scripting I guess its the easier part :v

Yeah, I have the models, but I don’t know how to put the skin/texture into the game. And how do you uv map ;~;. Sorry I’ve never done this before.

1 Like

I’ll try searching it up on youtube, and see what i can come up with.

1 Like

Well. Depending on your skills using your 3d software :v

If you use blender, heres some videos:

Youtube vid

https://www.youtube.com/watch?v=scPSP_U858k

Youtube vid

https://www.youtube.com/watch?v=Y7M-B6xnaEM

UV maping/unwrap is a little tedious task… Depends on the software you are using and your experience. You should learn how to do it first. Learn how to texture.

Your 3d model, has been made by you? you got it for free? is it coming with a texture folder, something?
If you have a texture already that works with the knife, then you only have to edit the image on photoshop, create a lot of “skins”

Import the textures into studio, and use the image id to place it in the TextureId property.
To change the TextureId dinamically, just access the property via script. Reach the meshModel and set the TextureID property

BTW. Importing a model is pretty simple:

Just create a “meshPart”, click “MeshId” into properties. Select your .obj file (or the available formats) Then click “TextureID” and select the image you want for the knife.

Ok. Thank you for all of the help you have offered me :slight_smile:

3 Likes

NP :3
Any doubts we all are here, good luck :3

One more thing. How would i get the texture id?

1 Like

In the Roblox Studio, find the window called “Explorer” (activate from view menu if u dont have it)
Theres a folder called “Images” right click on the image and select copyID.

From there u can right click Image folder and select “Import” too. So you can upload your textures to Roblox

Or you can just, create the meshPart on workspace, and check its properties, click the texture and mesh from there, it will ask for a location folder in ur pc, select them, those will be uploaded and you can see the id from properties too.

Maybe try inserting a meshpart with the 3d model of your knife, then add a texture to it. If that’s not what you wanted, create a script that detects when the player buys a certain skin, if the player has bought that skin, they can equip it, if you want to, I can explain further.

1 Like

im not a expert but maybe save the skin texture to roblox and make a script NOT LOCAL SCRIPT if you do a local script only the player will see it and no one else, put in the normal script the mesh (knife) tool and then make a UI and just do it so when the UI is pressed the mesh.texture changes into your skin (texture) ID.