I recommend creating a bigger text box with 0.7 Transparency that covers the entire screen, and put the script into it. You could also put a TextLabel saying “Click Anywhere to Hide”.
I am not sure, but the problem might be that if you write the name wrong, it will output an error.
Maybe you can try getting the player from it’s name (check if the player even exists), then change his shirt from his character.
I’ll test my solution, and edit my post if it works for me.
I managed to get it to work, what I have done differently, is that I got the text from the textBox, not from the parent, but from the local player, and now it works.
local script:
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.ChangeClothes:FireServer(player.PlayerGui.Test.TextBox.Text)
print(player.PlayerGui.Test.TextBox.Text)
end)
Replace Test with the name of your screenGui, and if you have also a frame, add .Frame to the screengui, but instead the .frame, write the name of the frame
Server Script:
game.ReplicatedStorage.ChangeClothes.OnServerEvent:Connect(function(p, plr)
print(plr)
if(game.Players:FindFirstChild(plr)) then
local player = game.Players:WaitForChild(plr)
player.Character:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=2733806108"
end
end)
@Aiden_12114 , does it work for you? I saw you liked my post but you did not reply if it worked or not, if it does, please accept my answer as the solution, so other people will know it is solved
Are you sure about that pranvexploder? Client changes can only be seen by the client, only for animations I believe it’s different.
I don’t think that local scripts can change other players’ clothing.
Edit: Pranvexploder, it does not work, changing it using the client does not work, what basically happens, is just the player that clicks the button can see the other player with the shirt, but the others can’t, because it affects only on 1 client.
this is my local script inside the button:
local playerReal = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local plr = playerReal.PlayerGui.Test.TextBox.Text
if(game.Players:FindFirstChild(plr)) then
local player = game.Players:WaitForChild(plr)
player.Character:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=2733806108"
end
end)