Hello, so basically I have a server script where it listens to a RemoteEvent when an item is bought, and when it picks it up it gets the item_name and I want to figure out whether it is a horn, trail, or a vine.
The problem with this script is that it prints out all of the items available depending on its class (horns, vines, trail).
For example, if a player buys the Purple Horns, it will print out
Earthraphobic2 bought the Yellow Horns.
Earthraphobic2 bought the Purple Horns.
Earthraphobic2 bought the Red Horns.
Earthraphobic2 bought the Black Horns.
Here is the script idk what went wrong with it:
game.ReplicatedStorage.BuyItem.OnServerEvent:Connect(function(plr, item_name)
local item = game.ServerStorage.Cosmetics[item_name]:Clone()
if not item then
return
end
if string.find(item_name, "Horns") then
print(plr.Name.. " bought the " ..item_name)
elseif string.find(item_name, "Trail") then
print(plr.Name.. " bought the " ..item_name)
elseif string.find(item_name, "Vines") then
print(plr.Name.. " bought the " ..item_name)
end
end)
How about you have a table that has all the items and what part of the body it corresponds too, then loop through that table and do what you need to do
Also if the cosmetics are accessories, you shouldnt have to tell where they have to go, the accessory will already be in the right position assuming you set it’s attachments positions correctly, once it’s put into the character it will position on its own
I’m still confused as to why you have to tell the script where to put the cosmetic, if your using some other sort of accessory system then I get that but, if your not already using accessories you just put the accessory inside of the player’s character and it positions it where it needs to be
I’m positioning it inside the script because the horns are models and I don’t really know how to position it without using the script because won’t it automatically position it once the player joins?