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

i get error attempt to concatenate Instance with string?

Asked by 3 years ago

i am trying to make it so that the camera will go to the player's show room

each player get's their own show room and i already scripted it to do that

local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Fixed

function triggered(player)
    camera.CameraType = Enum.CameraType.Fixed
    camera.CameraSubject = game.Workspace .. player .. "'s show room"
    print("camera is set to fixed")
end

game.Workspace.dealer.head.ProximityPrompt.Triggered:Connect(triggered)

if you need the script that makes the gives each player a show room

local show_room = script.Parent
local copy = show_room:Clone()

function new_child(child)
    if child.p_or_o.Value == "player" then
        copy.Parent = game.Workspace
        copy:MoveTo(Vector3.new(show_room.camera_part.Position.X + 10))
        copy.Name = child.Name .. "'s show room"
    end
    if child.p_or_o.Value == "object" then

    end
end

game.Workspace.ChildAdded:Connect(new_child)

the 1st script is a local script in starter player scripts the 2nd script is a server script in the show room model

1 answer

Log in to vote
0
Answered by 3 years ago
camera.CameraSubject = game.Workspace:FindFirstChild(player.Name .. "'s show room")
Ad

Answer this question