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

Need help with a script that changes a IntValue (?)

function onButtonClicked()
game.StarterGui.Camera.settings.display.res = 30
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

I'm editing this script so it changes the value of the resolution of something that I'm making. On the display.res part, it thinks that res is a property of display. How do I make this not happen?

What I'm getting in the output 23:26:06.085 - res is not a valid member of IntValue

From a confused beginner scripter

2 answers

function onButtonClicked(res)
game.StarterGui.Camera.settings.display.res = 30
end

script.Parent.MouseButton1Click:connect(onButtonClicked)

try this and is there a full script of this?

3 comments

0

you dont add res into the ()......

0

also sorry for 2 comments but it dosent work

0

That would error. MouseButton1Click doesn’t have parameters.

###This is because you didn’t add a .Value after res. Also, you’re using StarterGui instead of PlayerGui. I will fix your code. Do you not believe in variables? This is what causes people to access objects script.Parent style.

local plr = game:GetService("Players").LocalPlayer

function onButtonClick() -- no parameters. a previous answer had one, that would error.
    local cam = plr:WaitForChild("PlayerGui").Camera
    cam.Settings.Display.Res.Value = 30
        -- here was your problem
end

script.Parent.MouseButton1Click:Connect(onButtonClick)
-- Connect, not connect

###On a side note, use :Connect(), as ROBLOX has plans to remove :connect().

1 comment

0

Thanks man, sorry, im a beginner at lua. This fixed my bug. I really appreciate it.

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