I've looked for 2 hours now and just keep finding the same answer over and over. But the problem is, the answer doesn't work for me.
I'm trying to make a script that changes a player's face when they put in an id. I've looked up YouTube tutorials, looked at other answers on questions, but none of it has helped me. I do it the same as YouTube and yet it still doesn't work. Unless it has to go in a LocalScript (Which I don't think so, but I'm not certain) I have no idea. Help is very much appreciated.
ServerScript:
game.ReplicatedStorage.Appearance.OnServerEvent:Connect(function(plr, key) local Char = game.Workspace:FindFirstChild(plr.Name) local newTexture = "rbxassetid://" .. key Char.Head.face.Texture = newTexture end)
LocalScript:
script.Parent.FocusLost:Connect(function(enterPressed) if enterPressed then game.ReplicatedStorage.Appearance:FireServer(script.Parent.Text) end end)
hey i somehow found the answer. i think what your doing wrong is your using "rbxassetid://" .. key
what i did for my script was:
(BTW this is a server script placed inside StarterPlayer, StarterCharacterScripts)
game.ReplicatedStorage.test.OnServerEvent:Connect(function(plr, ide) script.Parent.Head.face:Destroy() local face = Instance.new("Decal", script.Parent.Head) face.Texture = "http://www.roblox.com/asset/?id="..ide face.Name = "face" end)
i used "http://www.roblox.com/asset/?id="
for my link thing.
i got rid of any spaces in between the the link the .. and the ide (which for you would be key)
i also changed the link format thing. not sure what you call it. and i made it where it would destroy any old face that was already there and replace it with a new one. and if that doesn't work i recommend going to the gui and adding a textbutton rather then seeing if the player presses enter because i feel like its something thats more guaranteed to work. heres the local script i used in my gui:
script.Parent.MouseButton1Click:Connect(function() local ide = script.Parent.Parent.TextBox.Text game.ReplicatedStorage.test:FireServer(ide) end)
this is placed inside the text button.
anyway i hope this helped you!
So... Nothing was working, and come to find out, I needed to get the id from the linked item, not the item on the catalog... Sorry to everyone that tried to help for wasting your time. :/
(My original script did work, I was just getting the wrong id)