Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

0
Don't use game.Workspace.Camera.FieldOfView. Use workspace.CurrentCamera Father_Odin 2 — 5y
0
Use game.Workspace.CurrentCamera I don't know why it's better but thet's what people recomend Zzverot 16 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

Ad

Answer this question