Issues getting attributes

I am trying to get the value of my attributes that I have placed in a part in serverstorage, what am I doing wrong?

image

In my local script:

-- Getting attributes
local minZoomAttributeFPS = game.ServerStorage.zoomAttributes:GetAttribute("minZoom")
local maxZoomAttributeFPS = game.ServerStorage.zoomAttributes:GetAttribute("maxZoom")

image

And from my function I want to place its values

in my function:
limitCameraUpDown(minZoomAttributeFPS, maxZoomAttributeFPS)

limitCameraUpDown:SetAttribute(minZoomAttributeFPS, maxZoomAttributeFPS)

1 Like

That’s a function, should I do it that way?

oh hold up my bad don’t forget to add a :WaitForChild()

local minZoomAttributeFPS = game.ServerStorage:WaitForChild(“zoomAttributes”):GetAttribute(“minZoom”)

local maxZoomAttributeFPS = game.ServerStorage:WaitForChild(“zoomAttributes”):GetAttribute(“maxZoom”)

either that or you can’t access it from ServerStorage

The reason why is because your script is on the client.

Instances in the Server Storage folders (ServerScriptService, ServerStorage) cannot be accessed by the client.

Move your parts to ReplicatedStorage and then change the code to this

-- Getting attributes
local minZoomAttributeFPS = game.ReplicatedStorage.zoomAttributes:GetAttribute("minZoom")
local maxZoomAttributeFPS = game.ReplicatedStorage.zoomAttributes:GetAttribute("maxZoom")
1 Like

Thanks a lot! it works perfect for me :smiley: