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

A different issue, but in the same script. Help?

So last time I posted about this, I spoke about the GUI Cloning issue. But this time, it's a different part of it. I have a brick that changes the players camera position. Which is here:

wait(0.03)

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera

repeat wait(0.03) until player.Character

player.Character:Destroy()
camera.CameraType = "Scriptable"
camera.CoordinateFrame = game.Workspace.CameraFocusPart.CFrame
camera.Focus = game.Workspace.CameraFocusPart.CFrame

Now inside the GUI script that clones, I'm trying to make it change the position of the CameraFocus Part to a different position when I click on a location on the map. (So like a zoom in on the location). It doesn't seem to work and returns this error:

"19:34:50 -- Workspace.PlacePoints.arenapoint.Script:10: ')' expected near ',' "

Please help!

local points = game.Workspace.PlacePoints
local ui = game.ReplicatedStorage.AINFOUI
local newui = ui:Clone()
local uisound = game.ReplicatedStorage.AINFOUI.SOUNDS.clicksound
local cam = game.Workspace.CameraFocusPart

function onClicked(Player)
	uisound:Play()
	newui.Parent = Player.PlayerGui
	game.Workspace.CameraFocusPart.CFrame.new = (189.468, 67.003, 95.912)
end

script.Parent.ClickDetector.MouseClick:Connect(onClicked)

6 comments

0

What that means is that CameraFocusPart is not in the workspace.

0

Is it inside of a model?

0

It's not, it's plain in workspace. Same name in all, even when I re-type it. It auto-corrects it to the part when I type "Workspace.cam"

0

Then something else is moving it lol

0

yeah probably being moved

0

There's no other script in the game "lol". Just the two in the post.

1 answer

I believe you are having a problem with setting the CFrame because you are saying CFrame.new =. What you need to do is:

game.Workspace.CameraFocusPart = CFrame.new(189.468, 67.003, 95.912)

CFrame.new is not a property of CameraFocusPart. I hope this helps and have a great day scripting!

1 comment

0

Well, I think it worked? But it didn't zoom, it's not giving me the error "CameraForucsPart is not a valid member of workspace"

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