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

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

Asked by 5 years ago
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

Log in to vote
0
Answered by
IcyMizu 122
5 years ago
Edited 5 years ago
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?

0
you dont add res into the ()...... TheHonkingGuy 7 — 5y
0
also sorry for 2 comments but it dosent work TheHonkingGuy 7 — 5y
0
That would error. MouseButton1Click doesn’t have parameters. User#19524 175 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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().

0
Thanks man, sorry, im a beginner at lua. This fixed my bug. I really appreciate it. TheHonkingGuy 7 — 5y

Answer this question