Help with tweening script for piggy game

CameraType is scriptable, still nothing

Have you tried putting local in front of your function?

local function doStuff()
    --Function stuff here
end

Can you provide your script that mentions where you set the camera type, from your example it’s not shown. I can’t think of something else that could be restricting it from working properly.

What do you mean? I set the cameratype to scriptable in the camera setting on explorer.

You have to set it at the start of the local script.

local currentCamera = game.Workspace.CurrentCamera

currentCamera.CameraType = Enum.CameraType.Scriptable
1 Like

Nope. Still the same as it was before.

As @xZylter has mentioned, you need to set it by a local script, it’s up to you when you choose to set it for your use case. By default, the camera will be set to custom so it can follow and attach to your character.

Have you made the function a local function?

I am fairly new to scripting, how do you do that? Just by saying local function

Try this code. I added the camera code and declared it as a local function.

local mainMenuMap = workspace:WaitForChild("MainMenuMap")
local tweenService = game:GetService("TweenService")
local btn = script.Parent

local currentCamera = game.Workspace.CurrentCamera
currentCamera.CameraType = Enum.CameraType.Scriptable

local function tweenCamera(pos,tweenTime)
     tweenService:Create(camera,TweenInfo.new(tweenTime,Enum.EasingStyle.Linear),{CFrame = pos.CFrame}):Play()
end

btn.MouseButton1Click:Connect(function()
    btn.Visible = false
    btn.Parent.Title.Visible = false

    tweenCamera(mainMenuMap.CameraPart2,1)
    wait(1)
    print("Reached Destination")
end)

idk if changing the function to local has any effect

1 Like

It’s just a good thing to learn and adjust to.

@Dev_Kittenz was correct. The script did not have any effect. Still broken.

Try changing MouseButton1Click to MouseButton1Down.

It is still broken. Does not seem to be changing every time we add a change :thinking:

Could you show a GIF or give a little bit more of an explanation of what is wrong with the script, I can’t see any fault in what has been provided to you unless I’m missing something.


@desinied

Is this supposed to be the “Penny” text?

Yes, its supposed to disappear when you press play.

Instead of this:

btn.Parent.Title.Visible = false

Use:

btn.Parent.TextLabel.Visible = false

Your script is looking for something named Title when in reality it was named TextLabel.