Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Unable to cast ID value to a dummy through a textbutton?

So pretty much I'm trying to make a textbox in which the player inputs a users name and it gets the ID and applies said ID to a dummy. I know how to get the ID, in fact it works like a charm for printing, however it gives me the error, "Unable to cast value to object" whenever I try to apply the ID to the Dummy. Here are both codes: Client/Local Script:

local Players = game:GetService("Players")
local textbox = script.Parent
textbox.ClearTextOnFocus = true
textbox.PlaceholderText = "Enter friend or random user's username"
local colorNormal = Color3.new(1, 1, 1)
local function onFocused()

	textbox.BackgroundColor3 = colorNormal
end
textbox.FocusLost:Connect(function(enterPressed, inputObject)
	if enterPressed then
		local text = textbox.Text
		local id = Players:GetUserIdFromNameAsync(text)
		game.ReplicatedStorage.dname:FireServer(id)
	end
end)

Server Script:

local dname = game.ReplicatedStorage:FindFirstChild("dname")
dname.OnServerEvent:Connect(function(player, id)
	print(id)
	game.workspace.Dummy.Humanoid:ApplyDescription(id)
end)

I've been searching of ways to fix this for hours now and I finally gave up and came to get help. If anyone knows why it isn't working I would be very grateful if you helped me out! Tysm!

1 answer

hey you! have you ever heard of enes? if you are in trouble, better call enes!

1 comment

0

So are you going to help me or is this just like a troll? Because I got really excited someone finally responded, yet it was just this...

This discussion is preserved as it was. New answers, comments, and votes are closed.