Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Clothing Doesn't Go On Avatar From Remote Event?

Asked by 3 years ago

So I'm making a clothing game test where I want people to test the clothing I make. When I make a event that calls it publicly it shows the player as without a shirt/pants. I'm not sure why this is happening even tho I did everything right.

If you could help or just tell me what to do I would be grateful!

The Local Script I use to fire from Shirt button is:

-- locals:
local Button = script.Parent
local localPlr = game.Players.LocalPlayer
local PutClothingEvent = game.ReplicatedStorage.Events.PutClothingEvent
local Id = script.Parent.Parent.Parent.ShirtId

Button.MouseButton1Click:Connect(function()
    if localPlr.Character:FindFirstChild("Shirt") then
        PutClothingEvent:FireServer("Shirt", "http://www.roblox.com/asset/?id="..Id.Value)
    else
        wait()
    end
end)

I used "http://www.roblox.com/asset/?id=" by the fact it showed in game like that. But it doesn't seem to appear

The other Local Script I use to fire from Pants button is:

-- locals:
local Button = script.Parent
local localPlr = game.Players.LocalPlayer
local PutClothingEvent = game.ReplicatedStorage.Events.PutClothingEvent
local Id = script.Parent.Parent.Parent.PantsId

Button.MouseButton1Click:Connect(function()
    if localPlr.Character:FindFirstChild("Pants") then
        PutClothingEvent:FireServer("Pants", "rbxassetid://"..Id.Value)
    else
        wait()
    end
end)

Same with "rbxassetid://" I used it and never appeard.

My Remote Event:

PutClothingEvent.OnServerEvent:Connect(function(localPlr, clothingType, clothingId)
    if clothingType == "Shirt" then
        local NewShirt = Instance.new("Shirt", localPlr)
        NewShirt.Name = "Shirt"
        localPlr.Character.Shirt:Destroy()
        NewShirt.ShirtTemplate = clothingId
        print(localPlr, "has just put on some shirt.")
    else
        local NewPants = Instance.new("Pants", localPlr)
        NewPants.Name = "Pants"
        localPlr.Character.Pants:Destroy()
        NewPants.PantsTemplate = clothingId
        print(localPlr, "has just put on some pants.")
    end
end)

What I used should work, but I'm not sure if it is ROBLOX's fault or I did something wrong.

I tried my best explaining the best I could, but if you can help thank you!

1 answer

Log in to vote
1
Answered by 3 years ago

Your not parenting them to the character

line 03 of your third example:

local NewShirt = Instance.new("Shirt", localPlr)

line 09 of your third example

local NewPants = Instance.new("Pants", localPlr)

try this:

PutClothingEvent.OnServerEvent:Connect(function(localPlr, clothingType, clothingId)
    if clothingType == "Shirt" then
        local NewShirt = Instance.new("Shirt")
        NewShirt.Name = "Shirt"
        localPlr.Character.Shirt:Destroy()
        NewShirt.ShirtTemplate = clothingId
        NewShirt.Parent = localPlr.Character
        print(localPlr, "has just put on some shirt.")
    else
        local NewPants = Instance.new("Pants")
        NewPants.Name = "Pants"
        localPlr.Character.Pants:Destroy()
        NewPants.PantsTemplate = clothingId
        NewPants.Parent = localPlr.Character
        print(localPlr, "has just put on some pants.")
    end
end)
0
Sorry for the late response, but it doesn't seem to work I'm not sure why hzesbemad 24 — 3y
0
are you sure your 'clothingId' is valid, also try using rbxassetid:// shadowstorm440 590 — 3y
Ad

Answer this question