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

What is unable to cast value to function?

workspace.Button.ProximityPrompt.Triggered:Connect(function()
	game.Players.LocalPlayer.PlayerGui.ConversationGui.Base:TweenPosition(
		UDim2.new(0.5, 0, 0.742, 0),
		"Out",
		"Sine",
		0,5,
		false
	)
	wait(2)
	game.Players.LocalPlayer.PlayerGui.ConversationGui.Base:TweenPosition(
		UDim2.new(0.5, 0, 1.2, 0),
		"Out",
		"Sine",
		0,5,
		false
	)
end)

Hi, this is my template script for future plans, But the current error im getting is ''Unable to cast value to function'' In line 2.

What does it mean and how do I get rid of it?

1 answer

✓ Accepted answer

You're using a comma to make float numbers, you should be using a dot!

0,5 is incorrect, 0.5 is correct

The error happens because, using the comma will make roblox think that 0 is one param, 5 is other and that false is other. The position where false is where a callback function should go.

You can read more here: https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition

1 comment

0

Ohhh!! I never intended to use a comma, thank you for the heads up I didn't see.

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