#how do i make this work

1 messages · Page 1 of 1 (latest)

snow schooner
candid dagger
#

set number inside the function

snow schooner
#

but im making it that you can change the number

candid dagger
#

i'll send some code in a second that should work

snow schooner
#

kk thx

#

ping me for it cuz i needa do stuff

#

plz

candid dagger
#

ok

#

@snow schooner try this

local Players = game:GetService("Players") -- game.Players
local rig = workspace.Rig
local humanoid = rig:WaitForChild("Humanoid") -- get the humanoid inside the rig
local frame = script.Parent.Gui.Frame

frame.TextButton.MouseButton1Click:Connect(function()
    local userId = frame.TextBox.Text -- get the current Text of the TextBox when the button is clicked
    local description = Players:GetHumanoidDescriptionFromUserId(userId)
    humanoid:ApplyDescription(description)
end)
snow schooner
#

kk

#

still doesnt work :\

candid dagger
#

was there an error?

snow schooner
#

no it just didnt work

modest martenBOT
#

studio** You are now Level 1! **studio

candid dagger
#

ok one sec

snow schooner
#

scripting is so cool yet so hard to do 💔

candid dagger
#

are you using a server script

#

or local

snow schooner
#

its a script (white one)

candid dagger
#

yes that means its running on roblox's server, which cant see whatever you type in the textbox cause thats limited to your client

snow schooner
#

oh so do local?

candid dagger
#

not exactly because only on the server can you do Players:GetHumanoidDescriptionFromUserId(...)

#

so you have to send a message to the server whenever you click the button, telling it what user id to load

#

you can do that with remote events

snow schooner
#

hm

candid dagger
#

put one of these in replicated storage

snow schooner
#

k

#

done

candid dagger
#

name it like "LoadUserId" or whatever

snow schooner
#

there

candid dagger
#

and then you can make a local script that basically does

LoadUserId:FireServer(frame.TextBox.Text)

when you click the button

#

and then a separate server script will handle the actual loading the rig

#

i will send the code

snow schooner
#

kk

#

so do i replace the serverscript with local oorrr?

#

aghjafamm,,./a,fnghaj'

candid dagger
#

yes. put a local script inside the TextButton:

local ReplicatedStorage = game:GetService("ReplicatedStorage") -- game.ReplicatedStorage (where the remote events should be)
local Players = game:GetService("Players")

local LoadUserId = ReplicatedStorage:WaitForChild("LoadUserId") -- get the remote event

script.Parent.MouseButton1Click:Connect(function()
    local userId = script.Parent.Parent.TextBox.Text
    LoadUserId:FireServer(userId)
end)

And put a server script (white one) inside "ServerScriptService" with this code:

local ReplicatedStorage = game:GetService("ReplicatedStorage") -- game.ReplicatedStorage (where the remote events should be)
local LoadUserId = ReplicatedStorage:WaitForChild("LoadUserId") -- get the remote event

local Players=game:GetService("Players")

local rig = workspace:WaitForChild("Rig")
local humanoid = rig:WaitForChild("Humanoid")

LoadUserId.OnServerEvent:Connect(function(player, userId) -- player = client who fired, userId = text from the textbox
    local description = Players:GetHumanoidDescriptionFromUserId(tonumber(userId))
    humanoid:ApplyDescription(description)
end)
#

make sure the local script is inside the text button and the server script is in ServerScriptService

snow schooner
#

ight thx

#

kk

#

yaayayayayayay it worked

#

thx alot man

candid dagger
#

nice

#

np