Gui viewportframe's visible.changed not triggering function

the script is a simplist script ever, but for some reason it dosn’t work even thought it should in theory, the error says that the its indexing boolean with “.changed”

local view = script.Parent
view.Visible.changed:Connect(function()
	while script.Parent.Visible == true do
	script.Parent.Ak.CFrame = script.Parent.Ak.CFrame * CFrame.Angles(0,0.05,0)
	wait(0.1)
	end
end)

It will not work in theory in the first place as this is what it is doing theoretically

local view = script.Parent
local boolean = view.Visible
print(boolean) -- true or false
local willItGiveARBXScriptSignal = boolean.Changed -- error

I believe you meant this when you want to detect a specific property and obtain that specific script signal through the use of :GetPropertyChangedSignal(“Visible”)

view:GetPropertyChangedSignal("Visible"):Connect(function()
	while script.Parent.Visible == true do
	script.Parent.Ak.CFrame = script.Parent.Ak.CFrame * CFrame.Angles(0,0.05,0)
	wait(0.1)
	end
end)
1 Like

huh thats werid the viewportframe object did not show up, no errors though

I suggest using or studying from this resource for viewport frames as a lot can go wrong ex:

  1. Wrong camera positioning and settings (Field of view is important as well)

  2. Wrong model positioning

There’s even a place file to study from. It’s the complete solution.

Even has good practices like rotating the camera instead of the model CFrame which is more efficient

Moving a viewport’s physical children is less performant than keeping them static. If you need to update the view, it’s better to move the camera than move the parts/models.

lol nvm im just dum i changed it localy in-game, worked with an script lol

local view = script.Parent

view.Changed:Connect(function()
	while task.wait(0.1) do
		if view.Visible then
			view.Ak.CFrame *= CFrame.Angles(0, 0.05, 0)
		else
			break
		end
	end
end)

This will work with the .Changed event.