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

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

Asked by 5 years ago

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)
0
What that means is that CameraFocusPart is not in the workspace. User#21908 42 — 5y
0
Is it inside of a model? User#21908 42 — 5y
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" Crusadious -6 — 5y
0
Then something else is moving it lol greatneil80 2647 — 5y
View all comments (2 more)
0
yeah probably being moved User#21908 42 — 5y
0
There's no other script in the game "lol". Just the two in the post. Crusadious -6 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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!

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" Crusadious -6 — 5y
Ad

Answer this question