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

I'm trying make a Field Of View Gui but nothing is happening?

I am trying to make it so that you enter a value in to a text box and then click a button and it sets the Field Of View to that number. references: v = value of text box f = game.Workspace.Camera.FieldOfView

fovbutton.MouseButton1Down:Connect(function()
	if v < 120 and v > 0 then
		currentvalue.Text = "Current FOV: " + v.Text
		f = v
	else
		currentvalue.Text = "Max FOV is 120, Minumum is 1"
		wait(3)
		currentvalue.Text = "Current FOV: " + v.Text
	end
end)

also this starts happening out of random when i click onto code instead of the normal flashing mouse thing where you are typing it's white and if I try type it deletes the character in front of it

2 comments

0

Don't use game.Workspace.Camera.FieldOfView. Use workspace.CurrentCamera

0

Use game.Workspace.CurrentCamera I don't know why it's better but thet's what people recomend

1 answer

✓ Accepted answer

This is not how you format strings in Lua. You are formatting in the manner string + string, which in Lua literally means it will attempt to add these two strings together. The Lua string concatenation operator is ".."

local formattedString = (string1..string2)

or in your case,

currentvalue.Text = ("Current FOV: "..v.Text)

note1: You will need to access the client's CurrentCamera instead of workspace's Camera.

note2: To fix the flashing white and odd character manipulating, try pressing end on your keyboard while inside of the script.

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